Macro assert_parse_span

Source
macro_rules! assert_parse_span {
    ($ty: ty, $str: literal) => { ... };
}
Expand description

(Requires feature “testing”) Given a Node, and a multiline string, this will expand to code that sets up a parser, and parses the first line of the given string with the parser. It will then create a second string based on the span data and append it to the first line of the string, showing what was parsed and where the span rests.

This uses parse, as it will be often used in situations where there may be trailing unparsed tokens.

use css_parse::*;
assert_parse_span!(T![Ident], r#"
    an_ident another_ident
    ^^^^^^^^
"#);