Skip to content

Commit 5a9de55

Browse files
committed
add ui tests
1 parent 3f2dd24 commit 5a9de55

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

src/test/ui/macros/issue-61033-1.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Regression test for issue #61033.
2+
3+
macro_rules! test1 {
4+
($x:ident, $($tt:tt)*) => { $($tt)+ } //~ERROR this must repeat at least once
5+
}
6+
7+
fn main() {
8+
test1!(x,);
9+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: this must repeat at least once
2+
--> $DIR/issue-61033-1.rs:4:34
3+
|
4+
LL | ($x:ident, $($tt:tt)*) => { $($tt)+ }
5+
| ^^^^^
6+
7+
error: aborting due to previous error
8+

src/test/ui/macros/issue-61033-2.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Regression test for issue #61033.
2+
3+
macro_rules! test2 {
4+
(
5+
$(* $id1:ident)*
6+
$(+ $id2:ident)*
7+
) => {
8+
$( //~ERROR meta-variable `id1` repeats 2 times
9+
$id1 + $id2 // $id1 and $id2 may repeat different numbers of times
10+
)*
11+
}
12+
}
13+
14+
fn main() {
15+
test2! {
16+
* a * b
17+
+ a + b + c
18+
}
19+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: meta-variable `id1` repeats 2 times, but `id2` repeats 3 times
2+
--> $DIR/issue-61033-2.rs:8:10
3+
|
4+
LL | $(
5+
| __________^
6+
LL | | $id1 + $id2 // $id1 and $id2 may repeat different numbers of times
7+
LL | | )*
8+
| |_________^
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)