mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-27 04:50:40 +00:00
Add custom ui regression test for duplicated blocks calls
This commit is contained in:
parent
a577f60d33
commit
129c3549d4
30
testing/tests/custom_ui/duplicated_block_calls.rs
Normal file
30
testing/tests/custom_ui/duplicated_block_calls.rs
Normal file
@ -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() {}
|
2
testing/tests/custom_ui/duplicated_block_calls.stderr
Normal file
2
testing/tests/custom_ui/duplicated_block_calls.stderr
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user