mirror of
https://github.com/askama-rs/askama.git
synced 2025-10-03 15:55:31 +00:00
Merge pull request #278 from Kijewski/issue-272
Add failing test from issue 272
This commit is contained in:
commit
96e9815fd5
5
testing/templates/block_in_include_base.html
Normal file
5
testing/templates/block_in_include_base.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{%- block block_in_base -%}
|
||||||
|
block_in_base: from base!
|
||||||
|
{%~ endblock -%}
|
||||||
|
|
||||||
|
{%- include "block_in_include_partial.html" -%}
|
9
testing/templates/block_in_include_extended.html
Normal file
9
testing/templates/block_in_include_extended.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{%- extends "block_in_include_base.html" -%}
|
||||||
|
|
||||||
|
{%- block block_in_base -%}
|
||||||
|
block_in_base: from extended!
|
||||||
|
{%~ endblock -%}
|
||||||
|
|
||||||
|
{%- block block_in_partial -%}
|
||||||
|
block_in_partial: from extended!
|
||||||
|
{%~ endblock -%}
|
3
testing/templates/block_in_include_partial.html
Normal file
3
testing/templates/block_in_include_partial.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{%- block block_in_partial -%}
|
||||||
|
block_in_partial: from partial!
|
||||||
|
{%~ endblock -%}
|
@ -53,3 +53,35 @@ fn test_include_macro() {
|
|||||||
|
|
||||||
assert_eq!(template.render().unwrap(), "Hello, Alice!\nHowdy, Bob!");
|
assert_eq!(template.render().unwrap(), "Hello, Alice!\nHowdy, Bob!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: <https://github.com/rinja-rs/rinja/issues/272>
|
||||||
|
#[test]
|
||||||
|
#[should_panic(expected = r#"assertion `left == right` failed
|
||||||
|
left: "block_in_base: from extended!\nblock_in_partial: from partial!\n"
|
||||||
|
right: "block_in_base: from extended!\nblock_in_partial: from extended!\n"#)]
|
||||||
|
fn block_in_include() {
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "block_in_include_extended.html")]
|
||||||
|
struct TmplExtended;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "block_in_include_base.html", block = "block_in_base")]
|
||||||
|
struct TmplBlockInBase;
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "block_in_include_partial.html", block = "block_in_partial")]
|
||||||
|
struct TmplBlockInPartial;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
TmplExtended.render().unwrap(),
|
||||||
|
"block_in_base: from extended!\nblock_in_partial: from extended!\n"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
TmplBlockInBase.render().unwrap(),
|
||||||
|
"block_in_base: from extended!\n"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
TmplBlockInPartial.render().unwrap(),
|
||||||
|
"block_in_partial: from extended!\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user