mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 22:41:13 +00:00
Add garbled closing block test
This commit is contained in:
parent
ae4ab28fd4
commit
e7f5de2697
39
testing/tests/ui/garbled-closing-blocks.rs
Normal file
39
testing/tests/ui/garbled-closing-blocks.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
use rinja::Template;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %-}{% endif %}")]
|
||||||
|
struct BlockSuppress {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %+}{% endif %}")]
|
||||||
|
struct BlockPreserve {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %~}{% endif %}")]
|
||||||
|
struct BlockFold {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %}{% endif %-}")]
|
||||||
|
struct BlockSuppress2 {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %}{% endif %+}")]
|
||||||
|
struct BlockPreserve2 {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(ext = "txt", source = "{% if cond %}{% endif %~}")]
|
||||||
|
struct BlockFold2 {
|
||||||
|
cond: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
47
testing/tests/ui/garbled-closing-blocks.stderr
Normal file
47
testing/tests/ui/garbled-closing-blocks.stderr
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:11
|
||||||
|
"%-}{% endif %}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:4:34
|
||||||
|
|
|
||||||
|
4 | #[template(ext = "txt", source = "{% if cond %-}{% endif %}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:11
|
||||||
|
"%+}{% endif %}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:10:34
|
||||||
|
|
|
||||||
|
10 | #[template(ext = "txt", source = "{% if cond %+}{% endif %}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:11
|
||||||
|
"%~}{% endif %}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:16:34
|
||||||
|
|
|
||||||
|
16 | #[template(ext = "txt", source = "{% if cond %~}{% endif %}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:22
|
||||||
|
"%-}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:22:34
|
||||||
|
|
|
||||||
|
22 | #[template(ext = "txt", source = "{% if cond %}{% endif %-}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:22
|
||||||
|
"%+}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:28:34
|
||||||
|
|
|
||||||
|
28 | #[template(ext = "txt", source = "{% if cond %}{% endif %+}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: failed to parse template source
|
||||||
|
--> <source attribute>:1:22
|
||||||
|
"%~}"
|
||||||
|
--> tests/ui/garbled-closing-blocks.rs:34:34
|
||||||
|
|
|
||||||
|
34 | #[template(ext = "txt", source = "{% if cond %}{% endif %~}")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Loading…
x
Reference in New Issue
Block a user