From bc77717d68e72d6241424362d2fe509d4fb4a2e4 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sat, 16 Dec 2023 20:57:20 +1100 Subject: [PATCH] coverage: Regression test for `assert!(!false)` --- tests/coverage/assert_not.cov-map | 16 ++++++++++++++++ tests/coverage/assert_not.coverage | 12 ++++++++++++ tests/coverage/assert_not.rs | 11 +++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/coverage/assert_not.cov-map create mode 100644 tests/coverage/assert_not.coverage create mode 100644 tests/coverage/assert_not.rs diff --git a/tests/coverage/assert_not.cov-map b/tests/coverage/assert_not.cov-map new file mode 100644 index 00000000000..788bc5dbf58 --- /dev/null +++ b/tests/coverage/assert_not.cov-map @@ -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) + diff --git a/tests/coverage/assert_not.coverage b/tests/coverage/assert_not.coverage new file mode 100644 index 00000000000..4cfdab974ed --- /dev/null +++ b/tests/coverage/assert_not.coverage @@ -0,0 +1,12 @@ + LL| |// edition: 2021 + LL| | + LL| |// Regression test for . + 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|} + diff --git a/tests/coverage/assert_not.rs b/tests/coverage/assert_not.rs new file mode 100644 index 00000000000..95204fcadd1 --- /dev/null +++ b/tests/coverage/assert_not.rs @@ -0,0 +1,11 @@ +// edition: 2021 + +// Regression test for . +// `assert!(true)` and `assert!(!false)` should have similar coverage spans. + +fn main() { + assert!(true); + assert!(!false); + assert!(!!true); + assert!(!!!false); +}