about summary refs log tree commit diff
path: root/tests/run-make/coverage/assert.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-06-12 18:07:04 +1000
committerZalathar <Zalathar@users.noreply.github.com>2023-06-28 11:09:19 +1000
commite0625b4586c5a0f855a1157b09ae384f5de0ecf7 (patch)
treed6f6d80e1d6b9aaec8b6340986a3e22475775651 /tests/run-make/coverage/assert.rs
parent22e119bbacd3aa11db04d84947b4fb2c5ccb0435 (diff)
downloadrust-e0625b4586c5a0f855a1157b09ae384f5de0ecf7.tar.gz
rust-e0625b4586c5a0f855a1157b09ae384f5de0ecf7.zip
Migrate most of the existing coverage tests over to `run-coverage`
Diffstat (limited to 'tests/run-make/coverage/assert.rs')
-rw-r--r--tests/run-make/coverage/assert.rs32
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/run-make/coverage/assert.rs b/tests/run-make/coverage/assert.rs
deleted file mode 100644
index c85f2748eb9..00000000000
--- a/tests/run-make/coverage/assert.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-#![allow(unused_assignments)]
-// expect-exit-status-101
-
-fn might_fail_assert(one_plus_one: u32) {
-    println!("does 1 + 1 = {}?", one_plus_one);
-    assert_eq!(1 + 1, one_plus_one, "the argument was wrong");
-}
-
-fn main() -> Result<(),u8> {
-    let mut countdown = 10;
-    while countdown > 0 {
-        if countdown == 1 {
-            might_fail_assert(3);
-        } else if countdown < 5 {
-            might_fail_assert(2);
-        }
-        countdown -= 1;
-    }
-    Ok(())
-}
-
-// Notes:
-//   1. Compare this program and its coverage results to those of the very similar test
-//      `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`.
-//   2. This test confirms the coverage generated when a program passes or fails an `assert!()` or
-//      related `assert_*!()` macro.
-//   3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produce
-//      conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call to
-//      `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails).
-//   4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this test
-//      (and in many other coverage tests). The `Assert` terminator is typically generated by the
-//      Rust compiler to check for runtime failures, such as numeric overflows.