From a03a06c33827be5c2c052d724f78967c1664dac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Fri, 17 May 2024 16:07:44 +0200 Subject: [PATCH] Add unclosed node ui tests --- testing/tests/ui/unclosed-nodes.rs | 51 ++++++++++++ testing/tests/ui/unclosed-nodes.stderr | 107 +++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 testing/tests/ui/unclosed-nodes.rs create mode 100644 testing/tests/ui/unclosed-nodes.stderr diff --git a/testing/tests/ui/unclosed-nodes.rs b/testing/tests/ui/unclosed-nodes.rs new file mode 100644 index 00000000..9fc69ecc --- /dev/null +++ b/testing/tests/ui/unclosed-nodes.rs @@ -0,0 +1,51 @@ +use askama::Template; + +#[derive(Template)] +#[template(source = "{{ expr", ext = "txt")] +struct Expr1; + +#[derive(Template)] +#[template(source = "{{ expr ", ext = "txt")] +struct Expr2; + +#[derive(Template)] +#[template(source = "{{ expr -", ext = "txt")] +struct Expr3; + +#[derive(Template)] +#[template(source = "{{ expr -}", ext = "txt")] +struct Expr4; + +#[derive(Template)] +#[template(source = "{% let x", ext = "txt")] +struct Node1; + +#[derive(Template)] +#[template(source = "{% let x ", ext = "txt")] +struct Node2; + +#[derive(Template)] +#[template(source = "{% let x -", ext = "txt")] +struct Node3; + +#[derive(Template)] +#[template(source = "{% let x -%", ext = "txt")] +struct Node4; + +#[derive(Template)] +#[template(source = "{# comment", ext = "txt")] +struct Comment1; + +#[derive(Template)] +#[template(source = "{# comment ", ext = "txt")] +struct Comment2; + +#[derive(Template)] +#[template(source = "{# comment -", ext = "txt")] +struct Comment3; + +#[derive(Template)] +#[template(source = "{# comment -#", ext = "txt")] +struct Comment4; + +fn main() {} diff --git a/testing/tests/ui/unclosed-nodes.stderr b/testing/tests/ui/unclosed-nodes.stderr new file mode 100644 index 00000000..d48c01bd --- /dev/null +++ b/testing/tests/ui/unclosed-nodes.stderr @@ -0,0 +1,107 @@ +error: failed to parse template source at row 1, column 7 near: + "" + --> tests/ui/unclosed-nodes.rs:3:10 + | +3 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 8 near: + "" + --> tests/ui/unclosed-nodes.rs:7:10 + | +7 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 9 near: + "" + --> tests/ui/unclosed-nodes.rs:11:10 + | +11 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 9 near: + "}" + --> tests/ui/unclosed-nodes.rs:15:10 + | +15 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 8 near: + "" + --> tests/ui/unclosed-nodes.rs:19:10 + | +19 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 9 near: + "" + --> tests/ui/unclosed-nodes.rs:23:10 + | +23 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 10 near: + "" + --> tests/ui/unclosed-nodes.rs:27:10 + | +27 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 10 near: + "%" + --> tests/ui/unclosed-nodes.rs:31:10 + | +31 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 10 near: + "" + --> tests/ui/unclosed-nodes.rs:35:10 + | +35 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 11 near: + "" + --> tests/ui/unclosed-nodes.rs:39:10 + | +39 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 12 near: + "" + --> tests/ui/unclosed-nodes.rs:43:10 + | +43 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: failed to parse template source at row 1, column 13 near: + "" + --> tests/ui/unclosed-nodes.rs:47:10 + | +47 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info)