Skip to content

Commit 7b31692

Browse files
committed
Also test that yes/no must be bare words
1 parent 9851445 commit 7b31692

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

tests/ui/coverage-attr/subword.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![feature(coverage_attribute)]
2+
//@ edition: 2021
3+
4+
// Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare
5+
// words, not part of a more complicated substructure.
6+
7+
#[coverage(yes(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
8+
fn yes_list() {}
9+
10+
#[coverage(no(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
11+
fn no_list() {}
12+
13+
#[coverage(yes = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
14+
fn yes_key() {}
15+
16+
#[coverage(no = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
17+
fn no_key() {}
18+
19+
fn main() {}

tests/ui/coverage-attr/subword.stderr

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: expected `coverage(off)` or `coverage(on)`
2+
--> $DIR/subword.rs:7:1
3+
|
4+
LL | #[coverage(yes(milord))]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: expected `coverage(off)` or `coverage(on)`
8+
--> $DIR/subword.rs:10:1
9+
|
10+
LL | #[coverage(no(milord))]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: expected `coverage(off)` or `coverage(on)`
14+
--> $DIR/subword.rs:13:1
15+
|
16+
LL | #[coverage(yes = "milord")]
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error: expected `coverage(off)` or `coverage(on)`
20+
--> $DIR/subword.rs:16:1
21+
|
22+
LL | #[coverage(no = "milord")]
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: aborting due to 4 previous errors
26+

0 commit comments

Comments
 (0)