@@ -35,7 +35,6 @@ import (
35
35
"arduino.cc/builder/types"
36
36
"github.com/stretchr/testify/require"
37
37
"path/filepath"
38
- "strings"
39
38
"testing"
40
39
)
41
40
@@ -90,15 +89,15 @@ func TestLoadSketch(t *testing.T) {
90
89
sketch := context [constants .CTX_SKETCH ].(* types.Sketch )
91
90
require .NotNil (t , sketch )
92
91
93
- require .True (t , strings . Index ( sketch .MainFile .Name , "sketch.ino" ) != - 1 )
92
+ require .Contains (t , sketch .MainFile .Name , "sketch.ino" )
94
93
95
94
require .Equal (t , 2 , len (sketch .OtherSketchFiles ))
96
- require .True (t , strings . Index ( sketch .OtherSketchFiles [0 ].Name , "old.pde" ) != - 1 )
97
- require .True (t , strings . Index ( sketch .OtherSketchFiles [1 ].Name , "other.ino" ) != - 1 )
95
+ require .Contains (t , sketch .OtherSketchFiles [0 ].Name , "old.pde" )
96
+ require .Contains (t , sketch .OtherSketchFiles [1 ].Name , "other.ino" )
98
97
99
98
require .Equal (t , 2 , len (sketch .AdditionalFiles ))
100
- require .True (t , strings . Index ( sketch .AdditionalFiles [0 ].Name , "header.h" ) != - 1 )
101
- require .True (t , strings . Index ( sketch .AdditionalFiles [1 ].Name , "helper.h" ) != - 1 )
99
+ require .Contains (t , sketch .AdditionalFiles [0 ].Name , "header.h" )
100
+ require .Contains (t , sketch .AdditionalFiles [1 ].Name , "helper.h" )
102
101
}
103
102
104
103
func TestFailToLoadSketchFromFolder (t * testing.T ) {
@@ -134,13 +133,13 @@ func TestLoadSketchFromFolder(t *testing.T) {
134
133
sketch := context [constants .CTX_SKETCH ].(* types.Sketch )
135
134
require .NotNil (t , sketch )
136
135
137
- require .True (t , strings . Index ( sketch .MainFile .Name , "sketch_with_subfolders.ino" ) != - 1 )
136
+ require .Contains (t , sketch .MainFile .Name , "sketch_with_subfolders.ino" )
138
137
139
138
require .Equal (t , 0 , len (sketch .OtherSketchFiles ))
140
139
141
140
require .Equal (t , 2 , len (sketch .AdditionalFiles ))
142
- require .True (t , strings . Index ( sketch .AdditionalFiles [0 ].Name , "other.cpp" ) != - 1 )
143
- require .True (t , strings . Index ( sketch .AdditionalFiles [1 ].Name , "other.h" ) != - 1 )
141
+ require .Contains (t , sketch .AdditionalFiles [0 ].Name , "other.cpp" )
142
+ require .Contains (t , sketch .AdditionalFiles [1 ].Name , "other.h" )
144
143
}
145
144
146
145
func TestLoadSketchWithBackup (t * testing.T ) {
@@ -160,7 +159,7 @@ func TestLoadSketchWithBackup(t *testing.T) {
160
159
sketch := context [constants .CTX_SKETCH ].(* types.Sketch )
161
160
require .NotNil (t , sketch )
162
161
163
- require .True (t , strings . Index ( sketch .MainFile .Name , "sketch.ino" ) != - 1 )
162
+ require .Contains (t , sketch .MainFile .Name , "sketch.ino" )
164
163
165
164
require .Equal (t , 0 , len (sketch .AdditionalFiles ))
166
165
require .Equal (t , 0 , len (sketch .OtherSketchFiles ))
0 commit comments