Skip to content

Commit

Permalink
Also test that yes/no must be bare words
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Jun 20, 2024
1 parent 8d766c2 commit 425cded
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ui/coverage-attr/subword.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 26 additions & 0 deletions tests/ui/coverage-attr/subword.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 425cded

Please sign in to comment.