mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-28 05:21:14 +00:00
Add unit-test for #531
This commit is contained in:
parent
526ce78cf0
commit
0613a509b6
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user