Also test that yes/no must be bare words
This commit is contained in:
parent
388aea471f
commit
ebb3aa0d46
2 changed files with 45 additions and 0 deletions
19
tests/ui/coverage-attr/subword.rs
Normal file
19
tests/ui/coverage-attr/subword.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#![feature(coverage_attribute)]
|
||||
//@ edition: 2021
|
||||
|
||||
// Check that yes/no in `#[coverage(yes)]` and `#[coverage(no)]` must be bare
|
||||
// words, not part of a more complicated substructure.
|
||||
|
||||
#[coverage(yes(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
|
||||
fn yes_list() {}
|
||||
|
||||
#[coverage(no(milord))] //~ ERROR expected `coverage(off)` or `coverage(on)`
|
||||
fn no_list() {}
|
||||
|
||||
#[coverage(yes = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
|
||||
fn yes_key() {}
|
||||
|
||||
#[coverage(no = "milord")] //~ ERROR expected `coverage(off)` or `coverage(on)`
|
||||
fn no_key() {}
|
||||
|
||||
fn main() {}
|
||||
26
tests/ui/coverage-attr/subword.stderr
Normal file
26
tests/ui/coverage-attr/subword.stderr
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
error: expected `coverage(off)` or `coverage(on)`
|
||||
--> $DIR/subword.rs:7:1
|
||||
|
|
||||
LL | #[coverage(yes(milord))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected `coverage(off)` or `coverage(on)`
|
||||
--> $DIR/subword.rs:10:1
|
||||
|
|
||||
LL | #[coverage(no(milord))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected `coverage(off)` or `coverage(on)`
|
||||
--> $DIR/subword.rs:13:1
|
||||
|
|
||||
LL | #[coverage(yes = "milord")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected `coverage(off)` or `coverage(on)`
|
||||
--> $DIR/subword.rs:16:1
|
||||
|
|
||||
LL | #[coverage(no = "milord")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue