summaryrefslogtreecommitdiffstats
path: root/tests/coverage/loops_branches.coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/coverage/loops_branches.coverage
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/coverage/loops_branches.coverage')
-rw-r--r--tests/coverage/loops_branches.coverage67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/coverage/loops_branches.coverage b/tests/coverage/loops_branches.coverage
new file mode 100644
index 000000000..8cd6f1be3
--- /dev/null
+++ b/tests/coverage/loops_branches.coverage
@@ -0,0 +1,67 @@
+ LL| |#![allow(unused_assignments, unused_variables, while_true)]
+ LL| |
+ LL| |// This test confirms that (1) unexecuted infinite loops are handled correctly by the
+ LL| |// InstrumentCoverage MIR pass; and (2) Counter Expressions that subtract from zero can be dropped.
+ LL| |
+ LL| |struct DebugTest;
+ LL| |
+ LL| |impl std::fmt::Debug for DebugTest {
+ LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ LL| 1| if true {
+ LL| 1| if false {
+ LL| 0| while true {}
+ LL| 1| }
+ LL| 1| write!(f, "cool")?;
+ ^0
+ LL| 0| } else {
+ LL| 0| }
+ LL| |
+ LL| 11| for i in 0..10 {
+ ^10
+ LL| 10| if true {
+ LL| 10| if false {
+ LL| 0| while true {}
+ LL| 10| }
+ LL| 10| write!(f, "cool")?;
+ ^0
+ LL| 0| } else {
+ LL| 0| }
+ LL| | }
+ LL| 1| Ok(())
+ LL| 1| }
+ LL| |}
+ LL| |
+ LL| |struct DisplayTest;
+ LL| |
+ LL| |impl std::fmt::Display for DisplayTest {
+ LL| 1| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ LL| 1| if false {
+ LL| 0| } else {
+ LL| 1| if false {
+ LL| 0| while true {}
+ LL| 1| }
+ LL| 1| write!(f, "cool")?;
+ ^0
+ LL| | }
+ LL| 11| for i in 0..10 {
+ ^10
+ LL| 10| if false {
+ LL| 0| } else {
+ LL| 10| if false {
+ LL| 0| while true {}
+ LL| 10| }
+ LL| 10| write!(f, "cool")?;
+ ^0
+ LL| | }
+ LL| | }
+ LL| 1| Ok(())
+ LL| 1| }
+ LL| |}
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| let debug_test = DebugTest;
+ LL| 1| println!("{:?}", debug_test);
+ LL| 1| let display_test = DisplayTest;
+ LL| 1| println!("{}", display_test);
+ LL| 1|}
+