forked from rinja-rs/rinja
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for
..
pattern in structs
- Loading branch information
1 parent
e94525f
commit 6ee3765
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use rinja::Template; | ||
|
||
struct X { | ||
a: u32, | ||
b: u32, | ||
} | ||
|
||
#[derive(Template)] | ||
#[template(source = " | ||
{%- if let X { a, .. } = x -%}hello {{ a }}{%- endif -%} | ||
", ext = "html")] | ||
struct T1 { | ||
x: X, | ||
} | ||
|
||
#[derive(Template)] | ||
#[template(source = " | ||
{%- if let X { a, .., } = x -%}hello {{ a }}{%- endif -%} | ||
", ext = "html")] | ||
struct T2 { | ||
x: X, | ||
} | ||
|
||
#[derive(Template)] | ||
#[template(source = " | ||
{%- if let X { a .. } = x -%}hello {{ a }}{%- endif -%} | ||
", ext = "html")] | ||
struct T3 { | ||
x: X, | ||
} | ||
|
||
#[derive(Template)] | ||
#[template(source = " | ||
{%- if let X { .. } = x -%}hello {{ a }}{%- endif -%} | ||
", ext = "html")] | ||
struct T4 { | ||
x: X, | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: unexpected `,` character after `..` | ||
failed to parse template source at row 2, column 20 near: | ||
", } = x -%}hello {{ a }}{%- endif -%}\n" | ||
--> tests/ui/let_destructuring_has_rest.rs:16:10 | ||
| | ||
16 | #[derive(Template)] | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: failed to parse template source at row 2, column 17 near: | ||
".. } = x -%}hello {{ a }}{%- endif -%}\n" | ||
--> tests/ui/let_destructuring_has_rest.rs:24:10 | ||
| | ||
24 | #[derive(Template)] | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0609]: no field `a` on type `&T4` | ||
--> tests/ui/let_destructuring_has_rest.rs:32:10 | ||
| | ||
32 | #[derive(Template)] | ||
| ^^^^^^^^ unknown field | ||
| | ||
= note: this error originates in the derive macro `Template` (in Nightly builds, run with -Z macro-backtrace for more info) |