2020-12-01 01:58:08 -06:00
|
|
|
1| 1|fn main() {
|
2020-10-05 18:36:10 -05:00
|
|
|
2| 1| let is_true = std::env::args().len() == 1;
|
|
|
|
3| 1| let mut countdown = 10;
|
|
|
|
4| |
|
|
|
|
5| 1| 'outer: while countdown > 0 {
|
|
|
|
6| 1| let mut a = 100;
|
|
|
|
7| 1| let mut b = 100;
|
|
|
|
8| 3| for _ in 0..50 {
|
|
|
|
9| 3| if a < 30 {
|
|
|
|
10| 0| break;
|
2020-12-01 01:58:08 -06:00
|
|
|
11| 3| }
|
2020-10-05 18:36:10 -05:00
|
|
|
12| 3| a -= 5;
|
|
|
|
13| 3| b -= 5;
|
|
|
|
14| 3| if b < 90 {
|
|
|
|
15| 1| a -= 10;
|
|
|
|
16| 1| if is_true {
|
|
|
|
17| 1| break 'outer;
|
Coverage tests for remaining TerminatorKinds and async, improve Assert
Tested and validate results for panic unwind, panic abort, assert!()
macro, TerminatorKind::Assert (for example, numeric overflow), and
async/await.
Implemented a previous documented idea to change Assert handling to be
the same as FalseUnwind and Goto, so it doesn't get its own
BasicCoverageBlock anymore. This changed a couple of coverage regions,
but I validated those changes are not any worse than the prior results,
and probably help assure some consistency (even if some people might
disagree with how the code region is consistently computed).
Fixed issue with async/await. AggregateKind::Generator needs to be
handled like AggregateKind::Closure; coverage span for the outer async
function should not "cover" the async body, which is actually executed
in a separate "closure" MIR.
2020-11-16 11:14:28 -06:00
|
|
|
18| 0| } else {
|
2020-10-05 18:36:10 -05:00
|
|
|
19| 0| a -= 2;
|
|
|
|
20| 0| }
|
|
|
|
21| 2| }
|
2020-12-01 01:58:08 -06:00
|
|
|
22| | }
|
2020-10-05 18:36:10 -05:00
|
|
|
23| 0| countdown -= 1;
|
2020-12-01 01:58:08 -06:00
|
|
|
24| | }
|
2020-10-05 18:36:10 -05:00
|
|
|
25| 1|}
|
|
|
|
|