tests/run-coverage into tests/coverage
LL| |#![allow(unused_assignments)]LL| |// failure-status: 101LL| |LL| 4|fn might_fail_assert(one_plus_one: u32) {LL| 4| println!("does 1 + 1 = {}?", one_plus_one);LL| 4| assert_eq!(1 + 1, one_plus_one, "the argument was wrong");^1LL| 3|}LL| |LL| 1|fn main() -> Result<(), u8> {LL| 1| let mut countdown = 10;LL| 11| while countdown > 0 {LL| 11| if countdown == 1 {LL| 1| might_fail_assert(3);LL| 10| } else if countdown < 5 {LL| 3| might_fail_assert(2);LL| 6| }LL| 10| countdown -= 1;LL| | }LL| 0| Ok(())LL| 0|}LL| |LL| |// Notes:LL| |// 1. Compare this program and its coverage results to those of the very similar testLL| |// `panic_unwind.rs`, and similar tests `abort.rs` and `try_error_result.rs`.LL| |// 2. This test confirms the coverage generated when a program passes or fails an `assert!()` orLL| |// related `assert_*!()` macro.LL| |// 3. Notably, the `assert` macros *do not* generate `TerminatorKind::Assert`. The macros produceLL| |// conditional expressions, `TerminatorKind::SwitchInt` branches, and a possible call toLL| |// `begin_panic_fmt()` (that begins a panic unwind, if the assertion test fails).LL| |// 4. `TerminatoKind::Assert` is, however, also present in the MIR generated for this testLL| |// (and in many other coverage tests). The `Assert` terminator is typically generated by theLL| |// Rust compiler to check for runtime failures, such as numeric overflows.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。