@@ -277,6 +277,8 @@ func (s *runTestSuite) TestRunTests_Run() {
277
277
ShowTime : true ,
278
278
}, s .out )
279
279
s .Require ().NoError (err )
280
+ s .Len (res .Stats .Success , 5 , "verbose and execute all failed" )
281
+ s .Len (res .Stats .Skipped , 0 , "verbose and execute all failed" )
280
282
s .Equal (res .Stats .TotalFailed (), 0 , "verbose and execute all failed" )
281
283
})
282
284
@@ -285,33 +287,41 @@ func (s *runTestSuite) TestRunTests_Run() {
285
287
Include : regexp .MustCompile ("0*" ),
286
288
}, s .out )
287
289
s .Require ().NoError (err )
290
+ s .Len (res .Stats .Success , 5 , "do not show time and execute all failed" )
291
+ s .Len (res .Stats .Skipped , 0 , "do not show time and execute all failed" )
288
292
s .Equal (res .Stats .TotalFailed (), 0 , "do not show time and execute all failed" )
289
293
})
290
294
291
- s .Run ("execute only test 008 but exclude all" , func () {
295
+ s .Run ("execute only test 8 but exclude all" , func () {
292
296
res , err := Run (s .cfg , s .ftwTests , RunnerConfig {
293
- Include : regexp .MustCompile ("008 " ),
297
+ Include : regexp .MustCompile ("-8$ " ), // test ID is matched in format `<ruleId>-<testId>`
294
298
Exclude : regexp .MustCompile ("0*" ),
295
299
}, s .out )
296
300
s .Require ().NoError (err )
297
- s .Equal (res .Stats .TotalFailed (), 0 , "do not show time and execute all failed" )
301
+ s .Len (res .Stats .Success , 1 , "execute only test 008 but exclude all" )
302
+ s .Len (res .Stats .Skipped , 4 , "execute only test 008 but exclude all" )
303
+ s .Equal (res .Stats .TotalFailed (), 0 , "execute only test 008 but exclude all" )
298
304
})
299
305
300
- s .Run ("exclude test 010 " , func () {
306
+ s .Run ("exclude test 10 " , func () {
301
307
res , err := Run (s .cfg , s .ftwTests , RunnerConfig {
302
- Exclude : regexp .MustCompile ("010 " ),
308
+ Exclude : regexp .MustCompile ("-10$ " ), // test ID is matched in format `<ruleId>-<testId>`
303
309
}, s .out )
304
310
s .Require ().NoError (err )
311
+ s .Len (res .Stats .Success , 4 , "failed to exclude test" )
312
+ s .Len (res .Stats .Skipped , 1 , "failed to exclude test" )
305
313
s .Equal (res .Stats .TotalFailed (), 0 , "failed to exclude test" )
306
314
})
307
315
308
316
s .Run ("test exceptions 1" , func () {
309
317
res , err := Run (s .cfg , s .ftwTests , RunnerConfig {
310
- Include : regexp .MustCompile ("1 *" ),
311
- Exclude : regexp .MustCompile ("0 *" ),
318
+ Include : regexp .MustCompile ("-1. *" ),
319
+ Exclude : regexp .MustCompile ("-0. *" ),
312
320
Output : output .Quiet ,
313
321
}, s .out )
314
322
s .Require ().NoError (err )
323
+ s .Len (res .Stats .Success , 4 , "failed to test exceptions" )
324
+ s .Len (res .Stats .Skipped , 1 , "failed to test exceptions" )
315
325
s .Equal (res .Stats .TotalFailed (), 0 , "failed to test exceptions" )
316
326
})
317
327
}
0 commit comments