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:
René Kijewski 2021-07-30 17:36:29 +02:00 committed by Dirkjan Ochtman
parent 4123ec37a2
commit 6d1cf5e43d
3 changed files with 38 additions and 0 deletions

View 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 %}

View 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

View File

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