@@ -40,6 +40,7 @@ mod rewriter;
4040mod shortcodes;
4141#[ path = "tests/sourcepos.rs" ]
4242mod sourcepos_;
43+ mod sourcepos_chars;
4344mod spoiler;
4445mod strikethrough;
4546mod subscript;
@@ -339,6 +340,17 @@ where
339340 }
340341}
341342
343+ macro_rules! assert_ast_match_set_opt_single {
344+ ( $opts: ident; $optclass: ident. $optname: ident = $val: expr_2021) => {
345+ $opts. $optclass. $optname = $val;
346+ } ;
347+ ( $opts: ident; $optclass: ident. $optname: ident) => {
348+ $opts. $optclass. $optname = true ;
349+ } ;
350+ }
351+
352+ pub ( crate ) use assert_ast_match_set_opt_single;
353+
342354macro_rules! assert_ast_match {
343355 ( [ $( $optclass: ident. $optname: ident ) ,* ] , $( $md: literal ) +, $amt: tt, ) => {
344356 assert_ast_match!(
@@ -354,6 +366,13 @@ macro_rules! assert_ast_match {
354366 |#[ allow( unused_variables) ] opts| { $( opts. $optclass. $optname = $val; ) * } ,
355367 ) ;
356368 } ;
369+ ( [ $( $optclass: ident. $optname: ident $( = $val: expr_2021) ? ) ,* ] , $( $md: literal ) +, $amt: tt) => {
370+ crate :: tests:: assert_ast_match_i(
371+ concat!( $( $md ) ,+ ) ,
372+ ast!( $amt) ,
373+ |#[ allow( unused_variables) ] opts| { $( assert_ast_match_set_opt_single!( opts; $optclass. $optname $( = $val) ? ) ; ) * } ,
374+ ) ;
375+ } ;
357376 ( [ $( $optclass: ident. $optname: ident ) ,* ] , $( $md: literal ) +, $amt: tt) => {
358377 assert_ast_match!(
359378 [ $( $optclass. $optname = true ) ,* ] ,
@@ -397,6 +416,15 @@ impl AstMatchTree {
397416 assert_eq ! ( text, & ncb. literal, "CodeBlock literal should match" ) ;
398417 asserted_text = true ;
399418 }
419+ NodeValue :: Code ( ref nc) => {
420+ assert_eq ! ( text, & nc. literal, "Code literal should match" ) ;
421+ asserted_text = true ;
422+ }
423+ #[ cfg( feature = "shortcodes" ) ]
424+ NodeValue :: ShortCode ( ref nsc) => {
425+ assert_eq ! ( text, & nsc. code, "Shortcode code should match" ) ;
426+ asserted_text = true ;
427+ }
400428 NodeValue :: HtmlBlock ( ref nhb) => {
401429 assert_eq ! ( text, & nhb. literal, "HtmlBlock literal should match" ) ;
402430 asserted_text = true ;
0 commit comments