@@ -408,7 +408,7 @@ fn optgroups() -> getopts::Options {
408408 let mut opts = getopts:: Options :: new ( ) ;
409409 opts. optflag ( "" , "include-ignored" , "Run ignored and not ignored tests" )
410410 . 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 " )
412412 . optflag ( "" , "test" , "Run tests and not benchmarks" )
413413 . optflag ( "" , "bench" , "Run benchmarks instead of tests" )
414414 . optflag ( "" , "list" , "List all tests and benchmarks" )
@@ -1376,12 +1376,9 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
13761376 // Skip tests that match any of the skip filters
13771377 filtered. retain ( |test| !opts. skip . iter ( ) . any ( |sf| matches_filter ( test, sf) ) ) ;
13781378
1379- // Set #[should_panic] tests to ignore
1379+ // Excludes #[should_panic] tests
13801380 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 ) ;
13851382 }
13861383
13871384 // maybe unignore tests
@@ -2009,23 +2006,20 @@ mod tests {
20092006 opts. exclude_should_panic = true ;
20102007
20112008 let mut tests = one_ignored_one_unignored_test ( ) ;
2012-
20132009 tests. push ( TestDescAndFn {
20142010 desc : TestDesc {
20152011 name : StaticTestName ( "3" ) ,
20162012 ignore : false ,
2017- should_panic : ShouldPanic :: YesWithMessage ( "should panic with message" ) ,
2013+ should_panic : ShouldPanic :: Yes ,
20182014 allow_fail : false ,
20192015 } ,
20202016 testfn : DynTestFn ( Box :: new ( move || { } ) ) ,
20212017 } ) ;
20222018
20232019 let filtered = filter_tests ( & opts, tests) ;
20242020
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 ) ) ;
20292023 }
20302024
20312025 #[ test]
0 commit comments