@@ -141,6 +141,10 @@ func TestUploadPropertiesComposition(t *testing.T) {
141
141
tests := []test {
142
142
// classic upload, requires port
143
143
{buildPath1 , "alice:avr:board1" , "port" , "" , false , "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol port -bspeed testdata/build_path_1/sketch.ino.hex" },
144
+ {buildPath1 , "alice:avr:board1" , "" , "" , false , "FAIL" },
145
+ // classic upload, no port
146
+ {buildPath1 , "alice:avr:board2" , "port" , "" , false , "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/build_path_1/sketch.ino.hex" },
147
+ {buildPath1 , "alice:avr:board2" , "" , "" , false , "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/build_path_1/sketch.ino.hex" },
144
148
}
145
149
for i , test := range tests {
146
150
t .Run (fmt .Sprintf ("SubTest%02d" , i ), func (t * testing.T ) {
@@ -160,9 +164,13 @@ func TestUploadPropertiesComposition(t *testing.T) {
160
164
outStream ,
161
165
errStream ,
162
166
)
163
- require .NoError (t , err )
164
- out := strings .TrimSpace (outStream .String ())
165
- require .Equal (t , strings .ReplaceAll (test .expected , "$$VERBOSE-VERIFY$$" , "quiet noverify" ), out )
167
+ if test .expected == "FAIL" {
168
+ require .Error (t , err )
169
+ } else {
170
+ require .NoError (t , err )
171
+ out := strings .TrimSpace (outStream .String ())
172
+ require .Equal (t , strings .ReplaceAll (test .expected , "$$VERBOSE-VERIFY$$" , "quiet noverify" ), out )
173
+ }
166
174
})
167
175
t .Run (fmt .Sprintf ("SubTest%02d-WithVerifyAndVerbose" , i ), func (t * testing.T ) {
168
176
outStream := & bytes.Buffer {}
@@ -181,15 +189,19 @@ func TestUploadPropertiesComposition(t *testing.T) {
181
189
outStream ,
182
190
errStream ,
183
191
)
184
- require .NoError (t , err )
185
- out := strings .Split (outStream .String (), "\n " )
186
- // With verbose enabled, the upload will output 3 lines:
187
- // - the command line that the cli is going to run
188
- // - the output of the command
189
- // - an empty line
190
- // we are interested in the second line
191
- require .Len (t , out , 3 )
192
- require .Equal (t , strings .ReplaceAll (test .expected , "$$VERBOSE-VERIFY$$" , "verbose verify" ), out [1 ])
192
+ if test .expected == "FAIL" {
193
+ require .Error (t , err )
194
+ } else {
195
+ require .NoError (t , err )
196
+ out := strings .Split (outStream .String (), "\n " )
197
+ // With verbose enabled, the upload will output 3 lines:
198
+ // - the command line that the cli is going to run
199
+ // - the output of the command
200
+ // - an empty line
201
+ // we are interested in the second line
202
+ require .Len (t , out , 3 )
203
+ require .Equal (t , strings .ReplaceAll (test .expected , "$$VERBOSE-VERIFY$$" , "verbose verify" ), out [1 ])
204
+ }
193
205
})
194
206
}
195
207
}
0 commit comments