cmd/covdata: update test expectations after coverage position change

CL 726800 changed cmd/cover to exclude brace tokens from coverage
ranges, shifting where coverage spans start (from the opening
brace to the first executable token inside the block).

Update the hardcoded position expectations in TestCovTool subtests
(Textfmt, MergeSimple, Subtract) to match the new positions.

Fixes #77608

Change-Id: Ia67ac8fac05d802b0e6ba25a4fbedf7e2f1ca8b4
GitHub-Last-Rev: e24345873b
GitHub-Pull-Request: golang/go#77637
Reviewed-on: https://go-review.googlesource.com/c/go/+/746000
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Rudy Regazzoni
2026-02-16 08:16:46 +00:00
committed by Gopher Robot
parent 845b7b0e49
commit f75c7ccaef

View File

@@ -414,7 +414,7 @@ func testTextfmt(t *testing.T, s state) {
dumplines(lines[0:10])
t.Errorf("textfmt: want %s got %s", want0, lines[0])
}
want1 := mainPkgPath + "/prog1.go:13.14,15.2 1 1"
want1 := mainPkgPath + "/prog1.go:14.2,15.1 1 1"
if lines[1] != want1 {
dumplines(lines[0:10])
t.Errorf("textfmt: want %s got %s", want1, lines[1])
@@ -545,7 +545,7 @@ func testMergeSimple(t *testing.T, s state, indir1, indir2, tag string) {
},
{
tag: "third function unit 0",
re: regexp.MustCompile(`^0: L23:C23 -- L24:C12 NS=1 = (\d+)$`),
re: regexp.MustCompile(`^0: L24:C2 -- L24:C12 NS=1 = (\d+)$`),
nonzero: true,
},
{
@@ -555,7 +555,7 @@ func testMergeSimple(t *testing.T, s state, indir1, indir2, tag string) {
},
{
tag: "third function unit 2",
re: regexp.MustCompile(`^2: L24:C12 -- L26:C3 NS=1 = (\d+)$`),
re: regexp.MustCompile(`^2: L25:C3 -- L26:C1 NS=1 = (\d+)$`),
nonzero: true,
},
}
@@ -727,7 +727,7 @@ func testSubtract(t *testing.T, s state) {
},
{
tag: "third function unit 0",
re: regexp.MustCompile(`^0: L23:C23 -- L24:C12 NS=1 = (\d+)$`),
re: regexp.MustCompile(`^0: L24:C2 -- L24:C12 NS=1 = (\d+)$`),
zero: true,
},
{
@@ -737,7 +737,7 @@ func testSubtract(t *testing.T, s state) {
},
{
tag: "third function unit 2",
re: regexp.MustCompile(`^2: L24:C12 -- L26:C3 NS=1 = (\d+)$`),
re: regexp.MustCompile(`^2: L25:C3 -- L26:C1 NS=1 = (\d+)$`),
zero: true,
},
}