From 585a992246bf0602bd81b922eee8c7a6d27e9317 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 22 Jan 2024 16:18:47 +0100 Subject: Add ui test for `extends` error --- testing/tests/ui/extends.rs | 18 ++++++++++++++++++ testing/tests/ui/extends.stderr | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 testing/tests/ui/extends.rs create mode 100644 testing/tests/ui/extends.stderr (limited to 'testing/tests') diff --git a/testing/tests/ui/extends.rs b/testing/tests/ui/extends.rs new file mode 100644 index 0000000..55c8b56 --- /dev/null +++ b/testing/tests/ui/extends.rs @@ -0,0 +1,18 @@ +use askama::Template; + +#[derive(Template)] +#[template( + source = r#"{%- extends "whatever.html" %}"#, + ext = "html" +)] +struct ExtendsPre; + +#[derive(Template)] +#[template( + source = r#"{% extends "whatever.html" -%}"#, + ext = "html" +)] +struct ExtendsPost; + +fn main() { +} diff --git a/testing/tests/ui/extends.stderr b/testing/tests/ui/extends.stderr new file mode 100644 index 0000000..346246d --- /dev/null +++ b/testing/tests/ui/extends.stderr @@ -0,0 +1,19 @@ +error: whitespace control is not allowed on `extends` + problems parsing template source at row 1, column 2 near: + "- extends \"whatever.html\" %}" + --> tests/ui/extends.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: whitespace control is not allowed on `extends` + problems parsing template source at row 1, column 2 near: + " extends \"whatever.html\" -%}" + --> tests/ui/extends.rs:10:10 + | +10 | #[derive(Template)] + | ^^^^^^^^ + | + = note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) -- cgit