mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 13:30:59 +00:00
Issue #379 was fixed
This PR adds the tests by @msrd0 <git@msrd0.de> that failed before. The error was fixed somewhen between f23162a and now, so these tests serve to prevent regressions in the future. I simplified the tests very slightly to omit whitespaces in the output.
This commit is contained in:
parent
4123ec37a2
commit
6d1cf5e43d
13
testing/templates/macro-import-str-cmp-macro.html
Normal file
13
testing/templates/macro-import-str-cmp-macro.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% macro strcmp0(s, other) -%}
|
||||
{%- if s == "foo" -%}
|
||||
foo
|
||||
{%- else if s == other -%}
|
||||
other
|
||||
{%- else -%}
|
||||
neither
|
||||
{%- endif -%}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro strcmp(s) %}
|
||||
{%- call strcmp0(s, "bar") -%}
|
||||
{% endmacro %}
|
15
testing/templates/macro-import-str-cmp.html
Normal file
15
testing/templates/macro-import-str-cmp.html
Normal file
@ -0,0 +1,15 @@
|
||||
{%- import "macro-import-str-cmp-macro.html" as macros -%}
|
||||
|
||||
A
|
||||
|
||||
{%- call macros::strcmp("foo") -%}
|
||||
|
||||
B
|
||||
|
||||
{%- call macros::strcmp("bar") -%}
|
||||
|
||||
C
|
||||
|
||||
{%- call macros::strcmp("cat") -%}
|
||||
|
||||
D
|
@ -63,3 +63,13 @@ fn test_nested_macro_with_args() {
|
||||
let t = NestedMacroArgsTemplate {};
|
||||
assert_eq!(t.render().unwrap(), "first second");
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "macro-import-str-cmp.html")]
|
||||
struct StrCmpTemplate;
|
||||
|
||||
#[test]
|
||||
fn str_cmp() {
|
||||
let t = StrCmpTemplate;
|
||||
assert_eq!(t.render().unwrap(), "AfooBotherCneitherD");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user