@@ -251,6 +251,24 @@ struct Verify<'a> {
251251 world : & ' a str ,
252252}
253253
254+ /// Helper structure describing a single composed runtime test case, sent to
255+ /// `LanguageMethods::should_fail_run`.
256+ struct RunCase < ' a > {
257+ /// The name of the test, e.g. the directory name such as `ping-pong`.
258+ name : & ' a str ,
259+ /// The component providing the "runner" world for this case.
260+ runner : & ' a Component ,
261+ /// The components providing "test" worlds composed with `runner`.
262+ tests : & ' a [ & ' a Component ] ,
263+ }
264+
265+ impl RunCase < ' _ > {
266+ /// Returns all components involved in this case.
267+ fn components ( & self ) -> impl Iterator < Item = & Component > {
268+ [ self . runner ] . into_iter ( ) . chain ( self . tests . iter ( ) . copied ( ) )
269+ }
270+ }
271+
254272/// Helper structure to package up runtime state associated with executing tests.
255273struct Runner {
256274 opts : Opts ,
@@ -767,6 +785,16 @@ impl Runner {
767785 component. path. file_name( ) . unwrap( ) . to_str( ) . unwrap( )
768786 ) ) ;
769787 }
788+ let should_fail = {
789+ let tests = test_components. iter ( ) . map ( |( c, _) | c) . collect :: < Vec < _ > > ( ) ;
790+ let case = RunCase {
791+ name : & case_name,
792+ runner : & runner,
793+ tests : & tests,
794+ } ;
795+ case. components ( )
796+ . any ( |c| c. language . obj ( ) . should_fail_run ( self , & case, c) )
797+ } ;
770798 let case_name = case_name. to_string ( ) ;
771799 let runner = runner. clone ( ) ;
772800 let runner_path = runner_path. to_path_buf ( ) ;
@@ -777,6 +805,7 @@ impl Runner {
777805 . with_context ( || format ! ( "failed to run `{}`" , case. name) ) ;
778806 me. render_error (
779807 StepResult :: new ( result)
808+ . should_fail ( should_fail)
780809 . metadata ( "runner" , runner. path . display ( ) )
781810 . metadata ( "compiled runner" , runner_path. display ( ) ) ,
782811 )
@@ -1308,6 +1337,18 @@ trait LanguageMethods {
13081337 false
13091338 }
13101339
1340+ /// Returns whether this language expects the composed runtime test `case`
1341+ /// to fail to execute, where `component` is this language's component
1342+ /// within the case.
1343+ ///
1344+ /// This is invoked once per component in a case, so `component` may be
1345+ /// either the runner or one of the test components; the case is expected
1346+ /// to fail if any component's language says so.
1347+ fn should_fail_run ( & self , runner : & Runner , case : & RunCase < ' _ > , component : & Component ) -> bool {
1348+ let _ = ( runner, case, component) ;
1349+ false
1350+ }
1351+
13111352 /// Performs a "check" or a verify that the generated bindings described by
13121353 /// `Verify` are indeed valid.
13131354 fn verify ( & self , runner : & Runner , verify : & Verify ) -> Result < ( ) > ;
0 commit comments