Skip to content

Commit

Permalink
Merge pull request #278 from Kijewski/issue-272
Browse files Browse the repository at this point in the history
Add failing test from issue 272
  • Loading branch information
GuillaumeGomez authored Nov 26, 2024
2 parents 23f6130 + 66dac1d commit 96e9815
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions testing/templates/block_in_include_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%- block block_in_base -%}
block_in_base: from base!
{%~ endblock -%}

{%- include "block_in_include_partial.html" -%}
9 changes: 9 additions & 0 deletions testing/templates/block_in_include_extended.html
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions testing/templates/block_in_include_partial.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- block block_in_partial -%}
block_in_partial: from partial!
{%~ endblock -%}
32 changes: 32 additions & 0 deletions testing/tests/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,35 @@ fn test_include_macro() {

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"
);
}

0 comments on commit 96e9815

Please sign in to comment.