File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -382,13 +382,23 @@ impl<'g> TestList<'g> {
382
382
// <test name>: test
383
383
// ...
384
384
385
- list_output. lines ( ) . map ( move |line| {
386
- line. strip_suffix ( ": test" ) . ok_or_else ( || {
385
+ list_output. lines ( ) . filter_map ( move |line| {
386
+ if line. ends_with ( ": benchmark" ) {
387
+ // These lines are produced by the default Rust benchmark harness (#[bench]).
388
+ // Ignore them.
389
+ return None ;
390
+ }
391
+
392
+ let res = line. strip_suffix ( ": test" ) . ok_or_else ( || {
387
393
ParseTestListError :: parse_line (
388
- format ! ( "line '{}' did not end with the string ': test'" , line) ,
394
+ format ! (
395
+ "line '{}' did not end with the string ': test' or ': benchmark'" ,
396
+ line
397
+ ) ,
389
398
list_output,
390
399
)
391
- } )
400
+ } ) ;
401
+ Some ( res)
392
402
} )
393
403
}
394
404
@@ -569,11 +579,14 @@ mod tests {
569
579
570
580
#[ test]
571
581
fn test_parse ( ) {
582
+ // Lines ending in ': benchmark' (output by the default Rust bencher) should be skipped.
572
583
let non_ignored_output = indoc ! { "
573
584
tests::foo::test_bar: test
574
585
tests::baz::test_quux: test
586
+ benches::should_be_skipped: benchmark
575
587
" } ;
576
588
let ignored_output = indoc ! { "
589
+ benches::ignored_should_be_skipped: benchmark
577
590
tests::ignored::test_bar: test
578
591
tests::baz::test_ignored: test
579
592
" } ;
You can’t perform that action at this time.
0 commit comments