diff --git a/testing/tests/custom_ui/duplicated_block_calls.rs b/testing/tests/custom_ui/duplicated_block_calls.rs new file mode 100644 index 00000000..e026c071 --- /dev/null +++ b/testing/tests/custom_ui/duplicated_block_calls.rs @@ -0,0 +1,30 @@ +use askama::Template; + +// Check if the block call is duplicated in the current template. +#[derive(Template)] +#[template( + source = r##"{% extends "base.html" %} + +{% block content %}{% endblock %} +{% block content %}{% endblock %} +"##, + ext = "txt", +)] +struct X { + title: &'static str, +} + +// Check if the block call is called in the extended template and in the current one. +#[derive(Template)] +#[template( + source = r##"{% extends "child.html" %} + +{% block content %}another{% endblock %} +"##, + ext = "txt", +)] +struct X2 { + title: &'static str, +} + +fn main() {} diff --git a/testing/tests/custom_ui/duplicated_block_calls.stderr b/testing/tests/custom_ui/duplicated_block_calls.stderr new file mode 100644 index 00000000..82f4509d --- /dev/null +++ b/testing/tests/custom_ui/duplicated_block_calls.stderr @@ -0,0 +1,2 @@ +⚠️ X.txt:4:3: block `content` was already called at `X.txt:3:3` so the previous one will be ignored +⚠️ X2.txt:3:3: block `content` was already called at `testing/templates/child.html:2:3` so the previous one will be ignored