diff options
Diffstat (limited to '')
-rw-r--r-- | askama_parser/src/node.rs | 8 | ||||
-rw-r--r-- | testing/tests/ui/name_mismatch_endmacro.stderr | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index b321c80..93fca73 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -484,7 +484,13 @@ impl<'a> Macro<'a> { |i| s.tag_block_start(i), opt(Whitespace::parse), ws(keyword("endmacro")), - cut(preceded(ws(opt(keyword(name))), opt(Whitespace::parse))), + cut(preceded( + opt(|before| { + let (after, end_name) = ws(identifier)(before)?; + check_end_name(before, after, name, end_name, "macro") + }), + opt(Whitespace::parse), + )), ))), ))); let (i, (contents, (_, pws2, _, nws2))) = end(i)?; diff --git a/testing/tests/ui/name_mismatch_endmacro.stderr b/testing/tests/ui/name_mismatch_endmacro.stderr index ef389a2..74101a4 100644 --- a/testing/tests/ui/name_mismatch_endmacro.stderr +++ b/testing/tests/ui/name_mismatch_endmacro.stderr @@ -1,4 +1,5 @@ -error: problems parsing template source at row 1, column 41 near: +error: expected name `foo` in `endmacro` tag, found `not_foo` + problems parsing template source at row 1, column 41 near: "not_foo %}" --> tests/ui/name_mismatch_endmacro.rs:3:10 | |