Skip to content

Commit 4bca420

Browse files
committed
[review] add lots more tests
1 parent bbce6ee commit 4bca420

18 files changed

+124
-20
lines changed

Diff for: tests/source/skip_macro_invocations/all.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// rustfmt-skip_macro_invocations: ["*"]
2+
3+
// Should skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should skip this invocation
9+
renamed_items!(
10+
const _: u8 = 0;
11+
);
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
// rustfmt-skip_macro_invocations: ["*","items"]
22

3-
macro_rules! items {
4-
($($arg:item)*) => { $($arg)* };
5-
}
6-
73
// Should skip this invocation
84
items!(
95
const _: u8 = 0;
106
);
117

128
// Should also skip this invocation, as the wildcard covers it
13-
use self::items as renamed_items;
149
renamed_items!(
1510
const _: u8 = 0;
1611
);

Diff for: tests/source/skip_macro_invocations/empty.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// rustfmt-skip_macro_invocations: []
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should not skip this invocation
9+
renamed_items!(
10+
const _: u8 = 0;
11+
);
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
// rustfmt-skip_macro_invocations: ["items"]
22

3-
macro_rules! items {
4-
($($arg:item)*) => { $($arg)* };
5-
}
6-
73
// Should skip this invocation
84
items!(
95
const _: u8 = 0;
106
);
117

128
// Should not skip this invocation
13-
use self::items as renamed_items;
149
renamed_items!(
1510
const _: u8 = 0;
1611
);

Diff for: tests/source/skip_macro_invocations/name_unknown.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["unknown"]
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);

Diff for: tests/source/skip_macro_invocations/names.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// rustfmt-skip_macro_invocations: ["foo","bar"]
2+
3+
// Should skip this invocation
4+
foo!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should skip this invocation
9+
bar!(
10+
const _: u8 = 0;
11+
);
12+
13+
// Should not skip this invocation
14+
baz!(
15+
const _: u8 = 0;
16+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["items"]
2+
3+
// Should not skip this invocation
4+
self::items!(
5+
const _: u8 = 0;
6+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["self::items"]
2+
3+
// Should skip this invocation
4+
self::items!(
5+
const _: u8 = 0;
6+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["self::items"]
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);

Diff for: tests/target/skip_macro_invocations/all.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// rustfmt-skip_macro_invocations: ["*"]
2+
3+
// Should skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should skip this invocation
9+
renamed_items!(
10+
const _: u8 = 0;
11+
);
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
// rustfmt-skip_macro_invocations: ["*","items"]
22

3-
macro_rules! items {
4-
($($arg:item)*) => { $($arg)* };
5-
}
6-
73
// Should skip this invocation
84
items!(
95
const _: u8 = 0;
106
);
117

128
// Should also skip this invocation, as the wildcard covers it
13-
use self::items as renamed_items;
149
renamed_items!(
1510
const _: u8 = 0;
1611
);

Diff for: tests/target/skip_macro_invocations/empty.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// rustfmt-skip_macro_invocations: []
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should not skip this invocation
9+
renamed_items!(
10+
const _: u8 = 0;
11+
);
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
// rustfmt-skip_macro_invocations: ["items"]
22

3-
macro_rules! items {
4-
($($arg:item)*) => { $($arg)* };
5-
}
6-
73
// Should skip this invocation
84
items!(
95
const _: u8 = 0;
106
);
117

128
// Should not skip this invocation
13-
use self::items as renamed_items;
149
renamed_items!(
1510
const _: u8 = 0;
1611
);

Diff for: tests/target/skip_macro_invocations/name_unknown.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["unknown"]
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);

Diff for: tests/target/skip_macro_invocations/names.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// rustfmt-skip_macro_invocations: ["foo","bar"]
2+
3+
// Should skip this invocation
4+
foo!(
5+
const _: u8 = 0;
6+
);
7+
8+
// Should skip this invocation
9+
bar!(
10+
const _: u8 = 0;
11+
);
12+
13+
// Should not skip this invocation
14+
baz!(
15+
const _: u8 = 0;
16+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["items"]
2+
3+
// Should not skip this invocation
4+
self::items!(
5+
const _: u8 = 0;
6+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["self::items"]
2+
3+
// Should skip this invocation
4+
self::items!(
5+
const _: u8 = 0;
6+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// rustfmt-skip_macro_invocations: ["self::items"]
2+
3+
// Should not skip this invocation
4+
items!(
5+
const _: u8 = 0;
6+
);

0 commit comments

Comments
 (0)