@@ -112,7 +112,7 @@ fn spawn_test_thread(
112112 config : Arc :: clone ( & test. config ) ,
113113 testpaths : test. testpaths . clone ( ) ,
114114 revision : test. revision . clone ( ) ,
115- should_panic : test. desc . should_panic ,
115+ should_fail : test. desc . should_fail ,
116116 completion_sender,
117117 } ;
118118 let thread_builder = thread:: Builder :: new ( ) . name ( test. desc . name . clone ( ) ) ;
@@ -127,7 +127,7 @@ struct TestThreadArgs {
127127 config : Arc < Config > ,
128128 testpaths : TestPaths ,
129129 revision : Option < String > ,
130- should_panic : ShouldPanic ,
130+ should_fail : ShouldFail ,
131131
132132 completion_sender : mpsc:: Sender < TestCompletion > ,
133133}
@@ -170,11 +170,11 @@ fn test_thread_main(args: TestThreadArgs) {
170170 }
171171
172172 // Interpret the presence/absence of a panic as test failure/success.
173- let outcome = match ( args. should_panic , panic_payload) {
174- ( ShouldPanic :: No , None ) | ( ShouldPanic :: Yes , Some ( _) ) => TestOutcome :: Succeeded ,
175- ( ShouldPanic :: No , Some ( _) ) => TestOutcome :: Failed { message : None } ,
176- ( ShouldPanic :: Yes , None ) => {
177- TestOutcome :: Failed { message : Some ( "test did not panic as expected" ) }
173+ let outcome = match ( args. should_fail , panic_payload) {
174+ ( ShouldFail :: No , None ) | ( ShouldFail :: Yes , Some ( _) ) => TestOutcome :: Succeeded ,
175+ ( ShouldFail :: No , Some ( _) ) => TestOutcome :: Failed { message : None } ,
176+ ( ShouldFail :: Yes , None ) => {
177+ TestOutcome :: Failed { message : Some ( "`//@ should-fail` test did not fail as expected" ) }
178178 }
179179 } ;
180180
@@ -338,7 +338,7 @@ pub(crate) struct CollectedTestDesc {
338338 pub ( crate ) filterable_path : Utf8PathBuf ,
339339 pub ( crate ) ignore : bool ,
340340 pub ( crate ) ignore_message : Option < Cow < ' static , str > > ,
341- pub ( crate ) should_panic : ShouldPanic ,
341+ pub ( crate ) should_fail : ShouldFail ,
342342}
343343
344344/// Whether console output should be colored or not.
@@ -350,9 +350,10 @@ pub enum ColorConfig {
350350 NeverColor ,
351351}
352352
353- /// Whether test is expected to panic or not.
353+ /// Tests with `//@ should-fail` are tests of compiletest itself, and should
354+ /// be reported as successful if and only if they would have _failed_.
354355#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
355- pub ( crate ) enum ShouldPanic {
356+ pub ( crate ) enum ShouldFail {
356357 No ,
357358 Yes ,
358359}
0 commit comments