@@ -408,7 +408,7 @@ fn optgroups() -> getopts::Options {
408
408
let mut opts = getopts:: Options :: new ( ) ;
409
409
opts. optflag ( "" , "include-ignored" , "Run ignored and not ignored tests" )
410
410
. optflag ( "" , "ignored" , "Run only ignored tests" )
411
- . optflag ( "" , "exclude-should-panic" , "Sets #[should_panic] tests to imply #[ignore] " )
411
+ . optflag ( "" , "exclude-should-panic" , "Excludes tests marked as should_panic " )
412
412
. optflag ( "" , "test" , "Run tests and not benchmarks" )
413
413
. optflag ( "" , "bench" , "Run benchmarks instead of tests" )
414
414
. optflag ( "" , "list" , "List all tests and benchmarks" )
@@ -1376,12 +1376,9 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
1376
1376
// Skip tests that match any of the skip filters
1377
1377
filtered. retain ( |test| !opts. skip . iter ( ) . any ( |sf| matches_filter ( test, sf) ) ) ;
1378
1378
1379
- // Set #[should_panic] tests to ignore
1379
+ // Excludes #[should_panic] tests
1380
1380
if opts. exclude_should_panic {
1381
- filtered
1382
- . iter_mut ( )
1383
- . filter ( |test| test. desc . should_panic != ShouldPanic :: No )
1384
- . for_each ( |test| test. desc . ignore = true ) ;
1381
+ filtered. retain ( |test| test. desc . should_panic == ShouldPanic :: No ) ;
1385
1382
}
1386
1383
1387
1384
// maybe unignore tests
@@ -2009,23 +2006,20 @@ mod tests {
2009
2006
opts. exclude_should_panic = true ;
2010
2007
2011
2008
let mut tests = one_ignored_one_unignored_test ( ) ;
2012
-
2013
2009
tests. push ( TestDescAndFn {
2014
2010
desc : TestDesc {
2015
2011
name : StaticTestName ( "3" ) ,
2016
2012
ignore : false ,
2017
- should_panic : ShouldPanic :: YesWithMessage ( "should panic with message" ) ,
2013
+ should_panic : ShouldPanic :: Yes ,
2018
2014
allow_fail : false ,
2019
2015
} ,
2020
2016
testfn : DynTestFn ( Box :: new ( move || { } ) ) ,
2021
2017
} ) ;
2022
2018
2023
2019
let filtered = filter_tests ( & opts, tests) ;
2024
2020
2025
- assert_eq ! ( filtered. len( ) , 3 ) ;
2026
- assert ! ( filtered[ 0 ] . desc. ignore) ;
2027
- assert ! ( !filtered[ 1 ] . desc. ignore) ;
2028
- assert ! ( filtered[ 2 ] . desc. ignore) ;
2021
+ assert_eq ! ( filtered. len( ) , 2 ) ;
2022
+ assert ! ( filtered. iter( ) . all( |test| test. desc. should_panic == ShouldPanic :: No ) ) ;
2029
2023
}
2030
2024
2031
2025
#[ test]
0 commit comments