mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
95939e8de7
commit
9d669ed47a
2 changed files with 8 additions and 7 deletions
|
|
@ -40,7 +40,8 @@ func check(t *testing.T, file string) {
|
||||||
if len(frags) == 1 {
|
if len(frags) == 1 {
|
||||||
continue
|
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 {
|
if err != nil {
|
||||||
t.Errorf("Invalid regexp after `ERROR HERE: `: %#q", frags[1])
|
t.Errorf("Invalid regexp after `ERROR HERE: `: %#q", frags[1])
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
12
misc/cgo/errors/testdata/err2.go
vendored
12
misc/cgo/errors/testdata/err2.go
vendored
|
|
@ -40,15 +40,15 @@ func main() {
|
||||||
C.foop = x // ERROR HERE
|
C.foop = x // ERROR HERE
|
||||||
|
|
||||||
// issue 13129: used to output error about C.unsignedshort with CC=clang
|
// issue 13129: used to output error about C.unsignedshort with CC=clang
|
||||||
var x C.ushort
|
var x1 C.ushort
|
||||||
x = int(0) // ERROR HERE: C\.ushort
|
x1 = int(0) // ERROR HERE: C\.ushort
|
||||||
|
|
||||||
// issue 13423
|
// issue 13423
|
||||||
_ = C.fopen() // ERROR HERE
|
_ = C.fopen() // ERROR HERE
|
||||||
|
|
||||||
// issue 13467
|
// issue 13467
|
||||||
var x rune = '✈'
|
var x2 rune = '✈'
|
||||||
var _ rune = C.transform(x) // ERROR HERE: C\.int
|
var _ rune = C.transform(x2) // ERROR HERE: C\.int
|
||||||
|
|
||||||
// issue 13635: used to output error about C.unsignedchar.
|
// issue 13635: used to output error about C.unsignedchar.
|
||||||
// This test tests all such types.
|
// This test tests all such types.
|
||||||
|
|
@ -91,10 +91,10 @@ func main() {
|
||||||
|
|
||||||
// issue 26745
|
// issue 26745
|
||||||
_ = func(i int) int {
|
_ = func(i int) int {
|
||||||
return C.i + 1 // ERROR HERE: :13
|
return C.i + 1 // ERROR HERE: 14
|
||||||
}
|
}
|
||||||
_ = func(i int) {
|
_ = func(i int) {
|
||||||
C.fi(i) // ERROR HERE: :6
|
C.fi(i) // ERROR HERE: 7
|
||||||
}
|
}
|
||||||
|
|
||||||
C.fi = C.fi // ERROR HERE
|
C.fi = C.fi // ERROR HERE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue