Skip to content

Commit c8bf124

Browse files
Lambdariszhuyunxing
authored and
zhuyunxing
committed
coverage. Fix missing LL line number replacement
1 parent eeb9fd4 commit c8bf124

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/tools/compiletest/src/runtest.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,14 @@ impl<'test> TestCx<'test> {
754754

755755
// ` |---> MC/DC Decision Region (1:` => ` |---> MC/DC Decision Region (LL:`
756756
static MCDC_DECISION_LINE_NUMBER_RE: Lazy<Regex> = Lazy::new(|| {
757-
Regex::new(r"(?m:^)(?<prefix>(?: \|)+---> MC/DC Decision Region \()[0-9]+:").unwrap()
757+
Regex::new(r"(?m:^)(?<prefix>(?: \|)+---> MC/DC Decision Region \()[0-9]+:(?<middle>[0-9]+\) to \()[0-9]+:").unwrap()
758758
});
759-
let coverage = MCDC_DECISION_LINE_NUMBER_RE.replace_all(&coverage, "${prefix}LL:");
759+
let coverage =
760+
MCDC_DECISION_LINE_NUMBER_RE.replace_all(&coverage, "${prefix}LL:${middle}LL:");
760761

761762
// ` | Condition C1 --> (1:` => ` | Condition C1 --> (LL:`
762763
static MCDC_CONDITION_LINE_NUMBER_RE: Lazy<Regex> = Lazy::new(|| {
763-
Regex::new(r"(?m:^)(?<prefix>(?: \|)+ Condition C\d+ --> \()[0-9]+:").unwrap()
764+
Regex::new(r"(?m:^)(?<prefix>(?: \|)+ Condition C[0-9]+ --> \()[0-9]+:").unwrap()
764765
});
765766
let coverage = MCDC_CONDITION_LINE_NUMBER_RE.replace_all(&coverage, "${prefix}LL:");
766767

tests/coverage/mcdc_if.coverage

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
LL| 2| if a && b {
88
^0
99
------------------
10-
|---> MC/DC Decision Region (LL:8) to (7:14)
10+
|---> MC/DC Decision Region (LL:8) to (LL:14)
1111
|
1212
| Number of Conditions: 2
1313
| Condition C1 --> (LL:8)
@@ -33,7 +33,7 @@
3333
LL| 2| if a && b {
3434
^1
3535
------------------
36-
|---> MC/DC Decision Region (LL:8) to (15:14)
36+
|---> MC/DC Decision Region (LL:8) to (LL:14)
3737
|
3838
| Number of Conditions: 2
3939
| Condition C1 --> (LL:8)
@@ -59,7 +59,7 @@
5959
LL| 2|fn mcdc_check_b(a: bool, b: bool) {
6060
LL| 2| if a && b {
6161
------------------
62-
|---> MC/DC Decision Region (LL:8) to (23:14)
62+
|---> MC/DC Decision Region (LL:8) to (LL:14)
6363
|
6464
| Number of Conditions: 2
6565
| Condition C1 --> (LL:8)
@@ -86,7 +86,7 @@
8686
LL| 3| if a && b {
8787
^2
8888
------------------
89-
|---> MC/DC Decision Region (LL:8) to (31:14)
89+
|---> MC/DC Decision Region (LL:8) to (LL:14)
9090
|
9191
| Number of Conditions: 2
9292
| Condition C1 --> (LL:8)
@@ -116,7 +116,7 @@
116116
LL| 4| if a && (b || c) {
117117
^3 ^2
118118
------------------
119-
|---> MC/DC Decision Region (LL:8) to (41:21)
119+
|---> MC/DC Decision Region (LL:8) to (LL:21)
120120
|
121121
| Number of Conditions: 3
122122
| Condition C1 --> (LL:8)
@@ -149,7 +149,7 @@
149149
LL| 4| if (a || b) && c {
150150
^1
151151
------------------
152-
|---> MC/DC Decision Region (LL:8) to (51:21)
152+
|---> MC/DC Decision Region (LL:8) to (LL:21)
153153
|
154154
| Number of Conditions: 3
155155
| Condition C1 --> (LL:9)
@@ -179,7 +179,7 @@
179179
LL| 3| if a || b {
180180
^0
181181
------------------
182-
|---> MC/DC Decision Region (LL:8) to (59:14)
182+
|---> MC/DC Decision Region (LL:8) to (LL:14)
183183
|
184184
| Number of Conditions: 2
185185
| Condition C1 --> (LL:8)
@@ -199,7 +199,7 @@
199199
LL| 3| if b && c {
200200
^2
201201
------------------
202-
|---> MC/DC Decision Region (LL:12) to (61:18)
202+
|---> MC/DC Decision Region (LL:12) to (LL:18)
203203
|
204204
| Number of Conditions: 2
205205
| Condition C1 --> (LL:12)

0 commit comments

Comments
 (0)