Add custom ui regression test for duplicated blocks calls

This commit is contained in:
Guillaume Gomez 2025-08-24 17:23:48 +02:00
parent a577f60d33
commit 129c3549d4
2 changed files with 32 additions and 0 deletions

View 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() {}

View 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