Skip to content

Commit

Permalink
coverage: Regression test for assert!(!false)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Dec 16, 2023
1 parent 1c6a061 commit bc77717
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/coverage/assert_not.cov-map
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Function name: assert_not::main
Raw bytes (33): 0x[01, 01, 02, 05, 00, 0d, 00, 05, 01, 06, 01, 01, 12, 05, 02, 05, 00, 14, 02, 01, 05, 00, 14, 0d, 01, 05, 00, 16, 06, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(1), rhs = Zero
- expression 1 operands: lhs = Counter(3), rhs = Zero
Number of file 0 mappings: 5
- Code(Counter(0)) at (prev + 6, 1) to (start + 1, 18)
- Code(Counter(1)) at (prev + 2, 5) to (start + 0, 20)
- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 20)
= (c1 - Zero)
- Code(Counter(3)) at (prev + 1, 5) to (start + 0, 22)
- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2)
= (c3 - Zero)

12 changes: 12 additions & 0 deletions tests/coverage/assert_not.coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
LL| |// edition: 2021
LL| |
LL| |// Regression test for <https://github.com/rust-lang/rust/issues/118904>.
LL| |// `assert!(true)` and `assert!(!false)` should have similar coverage spans.
LL| |
LL| 1|fn main() {
LL| 1| assert!(true);
LL| 1| assert!(!false);
LL| 1| assert!(!!true);
LL| 1| assert!(!!!false);
LL| 1|}

11 changes: 11 additions & 0 deletions tests/coverage/assert_not.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// edition: 2021

// Regression test for <https://github.com/rust-lang/rust/issues/118904>.
// `assert!(true)` and `assert!(!false)` should have similar coverage spans.

fn main() {
assert!(true);
assert!(!false);
assert!(!!true);
assert!(!!!false);
}

0 comments on commit bc77717

Please sign in to comment.