2024-06-18 03:18:15 -05:00
|
|
|
#![feature(coverage_attribute)]
|
2024-06-20 03:13:48 -05:00
|
|
|
//@ edition: 2021
|
2024-06-18 03:18:15 -05:00
|
|
|
|
|
|
|
// Tests the error messages produced (or not produced) by various unusual
|
|
|
|
// uses of the `#[coverage(..)]` attribute.
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off)] //~ ERROR multiple `coverage` attributes
|
2024-06-18 03:18:15 -05:00
|
|
|
#[coverage(off)]
|
|
|
|
fn multiple_consistent() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off)] //~ ERROR multiple `coverage` attributes
|
2024-06-18 03:18:15 -05:00
|
|
|
#[coverage(on)]
|
|
|
|
fn multiple_inconsistent() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn bare_word() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage = true] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn key_value() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage()] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn list_empty() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off, off)] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn list_consistent() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off, on)] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn list_inconsistent() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(bogus)] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn bogus_word() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(bogus, off)] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn bogus_word_before() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off, bogus)] //~ ERROR malformed `coverage` attribute input
|
2024-06-18 03:18:15 -05:00
|
|
|
fn bogus_word_after() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(off,)] // (OK!)
|
2024-06-18 03:18:15 -05:00
|
|
|
fn comma_after() {}
|
|
|
|
|
2024-06-20 03:13:48 -05:00
|
|
|
#[coverage(,off)] //~ ERROR expected identifier, found `,`
|
2024-06-18 03:18:15 -05:00
|
|
|
fn comma_before() {}
|
|
|
|
|
|
|
|
fn main() {}
|