Add unit-test for #531

This commit is contained in:
Markus Ebner 2025-07-22 00:42:51 +02:00
parent 526ce78cf0
commit 0613a509b6
No known key found for this signature in database
GPG Key ID: 2F4B02774683BA74

View File

@ -580,6 +580,31 @@ fn test_expr_macro_call_importchain_nested() {
assert_eq!(ExprMacroCall.render().unwrap(), "foo");
}
#[test]
fn test_expr_macro_call_named_arguments() {
#[derive(Template)]
#[template(
source = r#"
{%- macro testmacro(arg0 = "-", arg1 = 5) -%}
{{ arg0 }} | {{ arg1 }};
{%- endmacro -%}
{{- testmacro() }}
{{- testmacro("a") }}
{{- testmacro("b", 1337) }}
{{- testmacro("c", arg1 = 1338) }}
{{- testmacro(arg0 = "d", arg1 = 1339) -}}
"#,
ext = "html"
)]
struct ExprMacroCall;
// primarily checking for compilation
assert_eq!(
ExprMacroCall.render().unwrap(),
"- | 5;a | 5;b | 1337;c | 1338;d | 1339;"
);
}
#[test]
fn test_macro_caller_is_defined_check() {
#[derive(Template)]