Skip to content

Commit

Permalink
(test) adding line stripping test for partial/include stmts
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Jul 25, 2021
1 parent 4e31add commit c635706
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/partial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,30 @@ mod test {
"fruit: carrot,fruit: tomato,"
);
}

#[test]
fn line_stripping_with_inline_and_partial() {
let tpl0 = r#"{{#*inline "foo"}}foo
{{/inline}}
{{> foo}}
{{> foo}}
{{> foo}}"#;
let tpl1 = r#"{{#*inline "foo"}}foo{{/inline}}
{{> foo}}
{{> foo}}
{{> foo}}"#;

let hbs = Registry::new();
assert_eq!(
r#"foo
foo
foo
"#,
hbs.render_template(tpl0, &json!({})).unwrap()
);
assert_eq!(
r#"foofoofoo"#,
hbs.render_template(tpl1, &json!({})).unwrap()
);
}
}

0 comments on commit c635706

Please sign in to comment.