mirror of
https://github.com/golang/go
synced 2024-11-26 06:27:58 -07:00
test: avoid matching file names in errcheck
Fixes #17030. Change-Id: Ic7f237ac7553ae0176929056e64b01667ed59066 Reviewed-on: https://go-review.googlesource.com/31351 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
5a0d50f4eb
commit
57666c3fe8
@ -13,5 +13,5 @@ func main() {}
|
||||
// issue 1474
|
||||
|
||||
// important: no newline on end of next line.
|
||||
// 6g used to print <epoch> instead of bug332.go:111
|
||||
func (t *T) F() {} // ERROR "bug332"
|
||||
// 6g used to print <epoch> instead of bug332.go:111
|
||||
func (t *T) F() {} // ERROR "undefined: T"
|
@ -33,5 +33,5 @@ var _ = (*Val).val // ERROR "method"
|
||||
var v Val
|
||||
var pv = &v
|
||||
|
||||
var _ = pv.val() // ERROR "method"
|
||||
var _ = pv.val // ERROR "method"
|
||||
var _ = pv.val() // ERROR "pv.val undefined"
|
||||
var _ = pv.val // ERROR "pv.val undefined"
|
||||
|
@ -855,7 +855,13 @@ func (t *test) errorCheck(outStr string, wantAuto bool, fullshort ...string) (er
|
||||
matched := false
|
||||
n := len(out)
|
||||
for _, errmsg := range errmsgs {
|
||||
if we.re.MatchString(errmsg) {
|
||||
// Assume errmsg says "file:line: foo".
|
||||
// Cut leading "file:line: " to avoid accidental matching of file name instead of message.
|
||||
text := errmsg
|
||||
if i := strings.Index(text, " "); i >= 0 {
|
||||
text = text[i+1:]
|
||||
}
|
||||
if we.re.MatchString(text) {
|
||||
matched = true
|
||||
} else {
|
||||
out = append(out, errmsg)
|
||||
|
Loading…
Reference in New Issue
Block a user