Skip to content

Commit 53c389e

Browse files
committed
Added more tests for macros. Closes rust-lang#15.
It seems the issues we had have been resolved upstream.
1 parent 920d27b commit 53c389e

File tree

3 files changed

+74
-4
lines changed

3 files changed

+74
-4
lines changed

tests/cases/macros/new.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
#![feature(decl_macro, use_extern_macros)]
22
pub struct Item;
33

4+
pub macro foo() { Item }
5+
46
#[macro_export]
57
macro_rules! bar {
68
() => {
79
Item
810
}
911
}
1012

11-
#[allow(dead_code)]
12-
fn abc() -> Item {
13+
pub macro baz() { Item }
14+
15+
pub macro quux1() { Item }
16+
17+
#[macro_export]
18+
macro_rules! quux2 {
19+
() => {
20+
Item
21+
}
22+
}
23+
24+
pub fn abc() -> Item {
1325
bar!()
1426
}

tests/cases/macros/old.rs

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
#![feature(decl_macro, use_extern_macros)]
22
pub struct Item;
33

4+
pub macro foo() { Item }
5+
46
pub macro bar() { Item }
57

6-
fn abc() -> Item {
8+
#[macro_export]
9+
macro_rules! baz {
10+
() => {
11+
Item
12+
}
13+
}
14+
15+
pub macro qux1() { Item }
16+
17+
#[macro_export]
18+
macro_rules! qux2 {
19+
() => {
20+
Item
21+
}
22+
}
23+
24+
pub fn abc() -> Item {
725
bar!()
826
}

tests/cases/macros/stdout

+41-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1-
version bump: 1.0.0 -> (patch) -> 1.0.1
1+
version bump: 1.0.0 -> (breaking) -> 2.0.0
2+
warning: path changes to `qux1`
3+
--> $REPO_PATH/tests/cases/macros/old.rs:15:5
4+
|
5+
15 | pub macro qux1() { Item }
6+
| ^^^^^^^^^^^^^^^^^^^^^
7+
|
8+
= note: removed definition (breaking)
9+
10+
warning: path changes to `qux2`
11+
--> $REPO_PATH/tests/cases/macros/old.rs:18:1
12+
|
13+
18 | / macro_rules! qux2 {
14+
19 | | () => {
15+
20 | | Item
16+
21 | | }
17+
22 | | }
18+
| |_^
19+
|
20+
= note: removed definition (breaking)
21+
22+
warning: path changes to `quux1`
23+
--> $REPO_PATH/tests/cases/macros/new.rs:15:5
24+
|
25+
15 | pub macro quux1() { Item }
26+
| ^^^^^^^^^^^^^^^^^^^^^^
27+
|
28+
= note: added definition (technically breaking)
29+
30+
warning: path changes to `quux2`
31+
--> $REPO_PATH/tests/cases/macros/new.rs:18:1
32+
|
33+
18 | / macro_rules! quux2 {
34+
19 | | () => {
35+
20 | | Item
36+
21 | | }
37+
22 | | }
38+
| |_^
39+
|
40+
= note: added definition (technically breaking)
41+

0 commit comments

Comments
 (0)