aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests/ui/macro_named_argument.rs
blob: fe8a1949f226f2bf27df85b638d636b03dc9842a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use askama::Template;

#[derive(Template)]
#[template(source = "{%- macro thrice(param1, param2) -%}
{{ param1 }} {{ param2 }}
{%- endmacro -%}

{%- call thrice(param1=2, param3=3) -%}", ext = "html")]
struct InvalidNamedArg;

#[derive(Template)]
#[template(source = "{%- macro thrice(param1, param2) -%}
{{ param1 }} {{ param2 }}
{%- endmacro -%}

{%- call thrice(param1=2, param1=3) -%}", ext = "html")]
struct InvalidNamedArg2;

// Ensures that filters can't have named arguments.
#[derive(Template)]
#[template(source = "{%- macro thrice(param1, param2) -%}
{{ param1 }} {{ param2 }}
{%- endmacro -%}

{%- call thrice(3, param1=2) | filter(param1=12) -%}", ext = "html")]
struct InvalidNamedArg3;

// Ensures that named arguments can only be passed last.
#[derive(Template)]
#[template(source = "{%- macro thrice(param1, param2) -%}
{{ param1 }} {{ param2 }}
{%- endmacro -%}
{%- call thrice(param1=2, 3) -%}", ext = "html")]
struct InvalidNamedArg4;

// Ensures that named arguments can't be used for arguments before them.
#[derive(Template)]
#[template(source = "{%- macro thrice(param1, param2) -%}
{{ param1 }} {{ param2 }}
{%- endmacro -%}
{%- call thrice(3, param1=2) -%}", ext = "html")]
struct InvalidNamedArg5;

fn main() {
}