Bless coverage tests.

This commit is contained in:
Mara Bos 2025-11-12 12:44:59 +01:00
parent 8b20d0d0a1
commit 9b4843196c
6 changed files with 22 additions and 29 deletions

View file

@ -4,7 +4,6 @@
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");
^1
LL| 3|}
LL| |
LL| 1|fn main() -> Result<(), u8> {

View file

@ -21,7 +21,6 @@
LL| 1|fn eq_good_message() {
LL| 1| println!("b");
LL| 1| assert_eq!(Foo(1), Foo(1), "message b");
^0
LL| 1|}
LL| |
LL| 1|fn ne_good() {
@ -32,7 +31,6 @@
LL| 1|fn ne_good_message() {
LL| 1| println!("d");
LL| 1| assert_ne!(Foo(1), Foo(3), "message d");
^0
LL| 1|}
LL| |
LL| 1|fn eq_bad() {

View file

@ -15,7 +15,7 @@
LL| |
LL| 1| let mut some_string = Some(String::from("the string content"));
LL| 1| println!(
LL| 1| "The string or alt: {}"
LL| | "The string or alt: {}"
LL| | ,
LL| 1| some_string
LL| | .
@ -45,7 +45,7 @@
LL| 0| "alt string 2".to_owned()
LL| 0| };
LL| 1| println!(
LL| 1| "The string or alt: {}"
LL| | "The string or alt: {}"
LL| | ,
LL| 1| some_string
LL| | .
@ -57,7 +57,7 @@
LL| |
LL| 1| some_string = None;
LL| 1| println!(
LL| 1| "The string or alt: {}"
LL| | "The string or alt: {}"
LL| | ,
LL| 1| some_string
LL| | .
@ -87,7 +87,7 @@
LL| 1| "alt string 4".to_owned()
LL| 1| };
LL| 1| println!(
LL| 1| "The string or alt: {}"
LL| | "The string or alt: {}"
LL| | ,
LL| 1| some_string
LL| | .
@ -109,7 +109,7 @@
LL| 5| format!("'{}'", val)
LL| 5| };
LL| 1| println!(
LL| 1| "Repeated, quoted string: {:?}"
LL| | "Repeated, quoted string: {:?}"
LL| | ,
LL| 1| std::iter::repeat("repeat me")
LL| 1| .take(5)
@ -139,15 +139,15 @@
LL| |
LL| 1| let short_used_covered_closure_macro = | used_arg: u8 | println!("called");
LL| 1| let short_used_not_covered_closure_macro = | used_arg: u8 | println!("not called");
^0 ^0
^0
LL| 1| let _short_unused_closure_macro = | _unused_arg: u8 | println!("not called");
^0 ^0
^0
LL| |
LL| |
LL| |
LL| |
LL| 1| let _short_unused_closure_block = | _unused_arg: u8 | { println!("not called") };
^0^0 ^0 ^0
^0^0 ^0
LL| |
LL| 1| let _shortish_unused_closure = | _unused_arg: u8 | {
^0
@ -174,14 +174,14 @@
LL| 1| let _short_unused_closure_line_break_no_block2 =
LL| | | _unused_arg: u8 |
LL| 0| println!(
LL| 0| "not called"
LL| | "not called"
LL| | )
LL| | ;
LL| |
LL| 1| let short_used_not_covered_closure_line_break_no_block_embedded_branch =
LL| | | _unused_arg: u8 |
LL| | println!(
LL| 0| "not called: {}",
LL| | "not called: {}",
LL| 0| if is_true { "check" } else { "me" }
LL| | )
LL| | ;
@ -190,7 +190,7 @@
LL| | | _unused_arg: u8 |
LL| 0| {
LL| 0| println!(
LL| 0| "not called: {}",
LL| | "not called: {}",
LL| 0| if is_true { "check" } else { "me" }
LL| | )
LL| 0| }
@ -199,7 +199,7 @@
LL| 1| let short_used_covered_closure_line_break_no_block_embedded_branch =
LL| | | _unused_arg: u8 |
LL| | println!(
LL| 1| "not called: {}",
LL| | "not called: {}",
LL| 1| if is_true { "check" } else { "me" }
^0
LL| | )
@ -209,7 +209,7 @@
LL| | | _unused_arg: u8 |
LL| 1| {
LL| 1| println!(
LL| 1| "not called: {}",
LL| | "not called: {}",
LL| 1| if is_true { "check" } else { "me" }
^0
LL| | )

View file

@ -22,18 +22,17 @@
LL| 1| assert_ne!(bar, Foo(3));
LL| 1| assert_ne!(Foo(0), Foo(4));
LL| 1| assert_eq!(Foo(3), Foo(3), "with a message");
^0
LL| 1| println!("{:?}", bar);
LL| 1| println!("{:?}", Foo(1));
LL| |
LL| 1| assert_ne!(Foo(0), Foo(5), "{}", if is_true { "true message" } else { "false message" });
^0 ^0 ^0 ^0
^0 ^0 ^0
LL| 1| assert_ne!(
LL| | Foo(0)
LL| | ,
LL| | Foo(5)
LL| | ,
LL| 0| "{}"
LL| | "{}"
LL| | ,
LL| | if
LL| 0| is_true
@ -78,13 +77,13 @@
LL| 1| assert_ne!(
LL| | Foo(0),
LL| | Foo(4),
LL| 0| "with a message"
LL| | "with a message"
LL| | );
LL| | } else {
LL| 0| assert_eq!(
LL| | Foo(3),
LL| | Foo(3),
LL| 0| "with a message"
LL| | "with a message"
LL| | );
LL| | }
LL| 1| assert_ne!(
@ -122,17 +121,17 @@
LL| 0| Foo(1)
LL| | },
LL| | Foo(5),
LL| 0| "with a message"
LL| | "with a message"
LL| | );
LL| 1| assert_eq!(
LL| | Foo(1),
LL| | Foo(3),
LL| 1| "this assert should fail"
LL| | "this assert should fail"
LL| | );
LL| 0| assert_eq!(
LL| | Foo(3),
LL| | Foo(3),
LL| 0| "this assert should not be reached"
LL| | "this assert should not be reached"
LL| | );
LL| 0|}
LL| |
@ -156,12 +155,9 @@
LL| |
LL| 1|fn test1() {
LL| 1| debug!("debug is enabled");
^0
LL| 1| debug!("debug is enabled");
^0
LL| 1| let _ = 0;
LL| 1| debug!("debug is enabled");
^0
LL| 1| unsafe {
LL| 1| DEBUG_LEVEL_ENABLED = true;
LL| 1| }

View file

@ -19,7 +19,7 @@
LL| 1| let version_3_3_0 = Version::new(3, 3, 0);
LL| |
LL| 1| println!(
LL| 1| "{:?} < {:?} = {}",
LL| | "{:?} < {:?} = {}",
LL| | version_3_2_1,
LL| | version_3_3_0,
LL| 1| version_3_2_1 < version_3_3_0, //

View file

@ -12,7 +12,7 @@
LL| 1| println!(
LL| | // Keep this on a separate line, to distinguish instrumentation of
LL| | // `println!` from instrumentation of its arguments.
LL| 1| "hello"
LL| | "hello"
LL| | );
LL| 1|}