mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-02 15:25:19 +00:00
parser: add wrong node terminator test
This commit is contained in:
parent
ebcfff66cc
commit
0628afaf5e
27
testing/tests/ui/wrong-end.rs
Normal file
27
testing/tests/ui/wrong-end.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
use rinja::Template;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% for _ in 1..=10 %}{% end %}", ext = "txt")]
|
||||||
|
struct For;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% macro test() %}{% end %}", ext = "txt")]
|
||||||
|
struct Macro;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% filter upper %}{% end %}", ext = "txt")]
|
||||||
|
struct Filter;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% match () %}{% when () %}{% end %}", ext = "txt")]
|
||||||
|
struct Match;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% block body %}{% end %}", ext = "txt")]
|
||||||
|
struct Block;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(source = "{% if true %}{% end %}", ext = "txt")]
|
||||||
|
struct If;
|
||||||
|
|
||||||
|
fn main() {}
|
47
testing/tests/ui/wrong-end.stderr
Normal file
47
testing/tests/ui/wrong-end.stderr
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:24
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:4:21
|
||||||
|
|
|
||||||
|
4 | #[template(source = "{% for _ in 1..=10 %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:21
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:8:21
|
||||||
|
|
|
||||||
|
8 | #[template(source = "{% macro test() %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:21
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:12:21
|
||||||
|
|
|
||||||
|
12 | #[template(source = "{% filter upper %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:30
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:16:21
|
||||||
|
|
|
||||||
|
16 | #[template(source = "{% match () %}{% when () %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:19
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:20:21
|
||||||
|
|
|
||||||
|
20 | #[template(source = "{% block body %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:16
|
||||||
|
"end %}"
|
||||||
|
--> tests/ui/wrong-end.rs:24:21
|
||||||
|
|
|
||||||
|
24 | #[template(source = "{% if true %}{% end %}", ext = "txt")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
Loading…
x
Reference in New Issue
Block a user