diff --git a/testing/tests/ui/garbled-closing-blocks.rs b/testing/tests/ui/garbled-closing-blocks.rs new file mode 100644 index 00000000..642d5f12 --- /dev/null +++ b/testing/tests/ui/garbled-closing-blocks.rs @@ -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() {} diff --git a/testing/tests/ui/garbled-closing-blocks.stderr b/testing/tests/ui/garbled-closing-blocks.stderr new file mode 100644 index 00000000..d142a4ff --- /dev/null +++ b/testing/tests/ui/garbled-closing-blocks.stderr @@ -0,0 +1,47 @@ +error: failed to parse template source + --> :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 + --> :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 + --> :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 + --> :1:22 + "%-}" + --> tests/ui/garbled-closing-blocks.rs:22:34 + | +22 | #[template(ext = "txt", source = "{% if cond %}{% endif %-}")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: failed to parse template source + --> :1:22 + "%+}" + --> tests/ui/garbled-closing-blocks.rs:28:34 + | +28 | #[template(ext = "txt", source = "{% if cond %}{% endif %+}")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: failed to parse template source + --> :1:22 + "%~}" + --> tests/ui/garbled-closing-blocks.rs:34:34 + | +34 | #[template(ext = "txt", source = "{% if cond %}{% endif %~}")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^