diff options
| author | Ian Lance Taylor <iant@golang.org> | 2021-06-04 08:16:58 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-06-05 04:40:03 +0000 |
| commit | 9d669ed47a502ca540c7f3329f84d89fc0c53971 (patch) | |
| tree | cad843a75695027ffe3dfd4f90fcbe2054961e99 /misc/cgo/errors/errors_test.go | |
| parent | 95939e8de71d9e8d8deea3d1605bd34130588292 (diff) | |
| download | go-9d669ed47a502ca540c7f3329f84d89fc0c53971.tar.xz | |
misc/cgo/errors: use expected column numbers
The test was using the wrong column numbers, and was erroneously
passing because there happened to be line numbers that matched those
column numbers. Change the test harness to require the expected line
number for the ERROR HERE regexp case, so that this doesn't happen again.
Also rename a couple of variables in the test to avoid useless
redeclaration errors.
Fixes #46534
Change-Id: I2fcbf5e379c346de5346035c73d174a3980c0927
Reviewed-on: https://go-review.googlesource.com/c/go/+/324970
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'misc/cgo/errors/errors_test.go')
| -rw-r--r-- | misc/cgo/errors/errors_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/cgo/errors/errors_test.go b/misc/cgo/errors/errors_test.go index a077b59478..68a30a44fe 100644 --- a/misc/cgo/errors/errors_test.go +++ b/misc/cgo/errors/errors_test.go @@ -40,7 +40,8 @@ func check(t *testing.T, file string) { if len(frags) == 1 { continue } - re, err := regexp.Compile(string(frags[1])) + frag := fmt.Sprintf(":%d:.*%s", i+1, frags[1]) + re, err := regexp.Compile(frag) if err != nil { t.Errorf("Invalid regexp after `ERROR HERE: `: %#q", frags[1]) continue |
