Skip to content

Commit

Permalink
add ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed May 22, 2019
1 parent 3f2dd24 commit 5a9de55
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/test/ui/macros/issue-61033-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Regression test for issue #61033.

macro_rules! test1 {
($x:ident, $($tt:tt)*) => { $($tt)+ } //~ERROR this must repeat at least once
}

fn main() {
test1!(x,);
}
8 changes: 8 additions & 0 deletions src/test/ui/macros/issue-61033-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: this must repeat at least once
--> $DIR/issue-61033-1.rs:4:34
|
LL | ($x:ident, $($tt:tt)*) => { $($tt)+ }
| ^^^^^

error: aborting due to previous error

19 changes: 19 additions & 0 deletions src/test/ui/macros/issue-61033-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Regression test for issue #61033.

macro_rules! test2 {
(
$(* $id1:ident)*
$(+ $id2:ident)*
) => {
$( //~ERROR meta-variable `id1` repeats 2 times
$id1 + $id2 // $id1 and $id2 may repeat different numbers of times
)*
}
}

fn main() {
test2! {
* a * b
+ a + b + c
}
}
11 changes: 11 additions & 0 deletions src/test/ui/macros/issue-61033-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
error: meta-variable `id1` repeats 2 times, but `id2` repeats 3 times
--> $DIR/issue-61033-2.rs:8:10
|
LL | $(
| __________^
LL | | $id1 + $id2 // $id1 and $id2 may repeat different numbers of times
LL | | )*
| |_________^

error: aborting due to previous error

0 comments on commit 5a9de55

Please sign in to comment.