Skip to content

Commit

Permalink
coverage: Tests for except-unused-generics and `except-unused-funct…
Browse files Browse the repository at this point in the history
…ions`
  • Loading branch information
Zalathar committed Mar 12, 2024
1 parent 4a0cc88 commit d780a03
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/coverage/except-unused.default.cov-map
@@ -0,0 +1,32 @@
Function name: except_unused::unused_fn (unused)
Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Zero) at (prev + 21, 1) to (start + 2, 2)

Function name: except_unused::unused_generic::<_> (unused)
Raw bytes (9): 0x[01, 01, 00, 01, 00, 0d, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Zero) at (prev + 13, 1) to (start + 2, 2)

Function name: except_unused::used_fn
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)

Function name: except_unused::used_generic::<u32>
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)

30 changes: 30 additions & 0 deletions tests/coverage/except-unused.default.coverage
@@ -0,0 +1,30 @@
LL| |#![feature(coverage_attribute)]
LL| |#![allow(dead_code)]
LL| |
LL| |//@ edition: 2021
LL| |//@ revisions: default functions generics
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
LL| |
LL| 1|fn used_generic<T>(_x: T) {
LL| 1| println!("used_generic");
LL| 1|}
LL| |
LL| 0|fn unused_generic<T>(_x: T) {
LL| 0| println!("unused_generic");
LL| 0|}
LL| |
LL| 1|fn used_fn() {
LL| 1| println!("used_fn");
LL| 1|}
LL| |
LL| 0|fn unused_fn() {
LL| 0| println!("unused_fn");
LL| 0|}
LL| |
LL| |#[coverage(off)]
LL| |fn main() {
LL| | used_generic(0u32);
LL| | used_fn();
LL| |}

16 changes: 16 additions & 0 deletions tests/coverage/except-unused.functions.cov-map
@@ -0,0 +1,16 @@
Function name: except_unused::used_fn
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)

Function name: except_unused::used_generic::<u32>
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)

30 changes: 30 additions & 0 deletions tests/coverage/except-unused.functions.coverage
@@ -0,0 +1,30 @@
LL| |#![feature(coverage_attribute)]
LL| |#![allow(dead_code)]
LL| |
LL| |//@ edition: 2021
LL| |//@ revisions: default functions generics
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
LL| |
LL| 1|fn used_generic<T>(_x: T) {
LL| 1| println!("used_generic");
LL| 1|}
LL| |
LL| |fn unused_generic<T>(_x: T) {
LL| | println!("unused_generic");
LL| |}
LL| |
LL| 1|fn used_fn() {
LL| 1| println!("used_fn");
LL| 1|}
LL| |
LL| |fn unused_fn() {
LL| | println!("unused_fn");
LL| |}
LL| |
LL| |#[coverage(off)]
LL| |fn main() {
LL| | used_generic(0u32);
LL| | used_fn();
LL| |}

24 changes: 24 additions & 0 deletions tests/coverage/except-unused.generics.cov-map
@@ -0,0 +1,24 @@
Function name: except_unused::unused_fn (unused)
Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Zero) at (prev + 21, 1) to (start + 2, 2)

Function name: except_unused::used_fn
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)

Function name: except_unused::used_generic::<u32>
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)

30 changes: 30 additions & 0 deletions tests/coverage/except-unused.generics.coverage
@@ -0,0 +1,30 @@
LL| |#![feature(coverage_attribute)]
LL| |#![allow(dead_code)]
LL| |
LL| |//@ edition: 2021
LL| |//@ revisions: default functions generics
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
LL| |
LL| 1|fn used_generic<T>(_x: T) {
LL| 1| println!("used_generic");
LL| 1|}
LL| |
LL| |fn unused_generic<T>(_x: T) {
LL| | println!("unused_generic");
LL| |}
LL| |
LL| 1|fn used_fn() {
LL| 1| println!("used_fn");
LL| 1|}
LL| |
LL| 0|fn unused_fn() {
LL| 0| println!("unused_fn");
LL| 0|}
LL| |
LL| |#[coverage(off)]
LL| |fn main() {
LL| | used_generic(0u32);
LL| | used_fn();
LL| |}

29 changes: 29 additions & 0 deletions tests/coverage/except-unused.rs
@@ -0,0 +1,29 @@
#![feature(coverage_attribute)]
#![allow(dead_code)]

//@ edition: 2021
//@ revisions: default functions generics
//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics

fn used_generic<T>(_x: T) {
println!("used_generic");
}

fn unused_generic<T>(_x: T) {
println!("unused_generic");
}

fn used_fn() {
println!("used_fn");
}

fn unused_fn() {
println!("unused_fn");
}

#[coverage(off)]
fn main() {
used_generic(0u32);
used_fn();
}

0 comments on commit d780a03

Please sign in to comment.