@@ -22,7 +22,8 @@ use whippit::{
2222 ParseError , SectionHeader ,
2323 } ,
2424 reexport:: chumsky:: {
25- input:: Emitter ,
25+ extra:: ParserExtra ,
26+ input:: { Emitter , Input , StrInput } ,
2627 prelude:: Rich ,
2728 primitive:: { any, choice, end, group, just, one_of} ,
2829 span:: SimpleSpan ,
@@ -1284,24 +1285,30 @@ impl Display for TestOutcome {
12841285 }
12851286}
12861287
1288+ impl TestOutcome {
1289+ pub ( crate ) fn parser < ' a , I , E > ( ) -> impl Parser < ' a , I , TestOutcome , E > + Clone
1290+ where
1291+ I : Input < ' a , Token = char > + StrInput < ' a , char > ,
1292+ E : ParserExtra < ' a , I > ,
1293+ {
1294+ choice ( (
1295+ keyword ( OK ) . to ( TestOutcome :: Ok ) ,
1296+ keyword ( PASS ) . to ( TestOutcome :: Pass ) ,
1297+ keyword ( FAIL ) . to ( TestOutcome :: Fail ) ,
1298+ keyword ( CRASH ) . to ( TestOutcome :: Crash ) ,
1299+ keyword ( TIMEOUT ) . to ( TestOutcome :: Timeout ) ,
1300+ keyword ( ERROR ) . to ( TestOutcome :: Error ) ,
1301+ keyword ( SKIP ) . to ( TestOutcome :: Skip ) ,
1302+ ) )
1303+ }
1304+ }
1305+
12871306impl < ' a > Properties < ' a > for TestProps < TestOutcome > {
12881307 type ParsedProperty = TestProp < TestOutcome > ;
12891308 fn property_parser (
12901309 helper : & mut PropertiesParseHelper < ' a > ,
12911310 ) -> Boxed < ' a , ' a , & ' a str , Self :: ParsedProperty , ParseError < ' a > > {
1292- TestProp :: property_parser (
1293- helper,
1294- choice ( (
1295- keyword ( OK ) . to ( TestOutcome :: Ok ) ,
1296- keyword ( PASS ) . to ( TestOutcome :: Pass ) ,
1297- keyword ( FAIL ) . to ( TestOutcome :: Fail ) ,
1298- keyword ( CRASH ) . to ( TestOutcome :: Crash ) ,
1299- keyword ( TIMEOUT ) . to ( TestOutcome :: Timeout ) ,
1300- keyword ( ERROR ) . to ( TestOutcome :: Error ) ,
1301- keyword ( SKIP ) . to ( TestOutcome :: Skip ) ,
1302- ) ) ,
1303- )
1304- . boxed ( )
1311+ TestProp :: property_parser ( helper, TestOutcome :: parser ( ) ) . boxed ( )
13051312 }
13061313
13071314 fn add_property ( & mut self , prop : Self :: ParsedProperty , emitter : & mut Emitter < Rich < ' a , char > > ) {
@@ -1343,22 +1350,28 @@ impl Display for SubtestOutcome {
13431350 }
13441351}
13451352
1353+ impl SubtestOutcome {
1354+ pub ( crate ) fn parser < ' a , I , E > ( ) -> impl Parser < ' a , I , SubtestOutcome , E > + Clone
1355+ where
1356+ I : Input < ' a , Token = char > + StrInput < ' a , char > ,
1357+ E : ParserExtra < ' a , I > ,
1358+ {
1359+ choice ( (
1360+ keyword ( PASS ) . to ( SubtestOutcome :: Pass ) ,
1361+ keyword ( FAIL ) . to ( SubtestOutcome :: Fail ) ,
1362+ keyword ( TIMEOUT ) . to ( SubtestOutcome :: Timeout ) ,
1363+ keyword ( CRASH ) . to ( SubtestOutcome :: Crash ) ,
1364+ keyword ( NOTRUN ) . to ( SubtestOutcome :: NotRun ) ,
1365+ ) )
1366+ }
1367+ }
1368+
13461369impl < ' a > Properties < ' a > for TestProps < SubtestOutcome > {
13471370 type ParsedProperty = TestProp < SubtestOutcome > ;
13481371 fn property_parser (
13491372 helper : & mut PropertiesParseHelper < ' a > ,
13501373 ) -> Boxed < ' a , ' a , & ' a str , Self :: ParsedProperty , ParseError < ' a > > {
1351- TestProp :: property_parser (
1352- helper,
1353- choice ( (
1354- keyword ( PASS ) . to ( SubtestOutcome :: Pass ) ,
1355- keyword ( FAIL ) . to ( SubtestOutcome :: Fail ) ,
1356- keyword ( TIMEOUT ) . to ( SubtestOutcome :: Timeout ) ,
1357- keyword ( CRASH ) . to ( SubtestOutcome :: Crash ) ,
1358- keyword ( NOTRUN ) . to ( SubtestOutcome :: NotRun ) ,
1359- ) ) ,
1360- )
1361- . boxed ( )
1374+ TestProp :: property_parser ( helper, SubtestOutcome :: parser ( ) ) . boxed ( )
13621375 }
13631376
13641377 fn add_property ( & mut self , prop : Self :: ParsedProperty , emitter : & mut Emitter < Rich < ' a , char > > ) {
0 commit comments