Macro assert_parse_error

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

(Requires feature “testing”) Given a Node, and a string, this will expand to code that sets up a parser, and parses the given string against the given node. If the parse succeeded this macro will panic with a readable failure.

In rare cases it might be necessary to ensure the resulting string differs from the input, for example if a grammar is serialized in a specific order but allows parsing in any order (many style values do this). In these cases, a second string can be provided which will be asserted gainst the output instead.

use css_parse::*;
assert_parse_error!(T![Ident], "1");