Commit 57666c3f authored by Russ Cox's avatar Russ Cox Committed by Brad Fitzpatrick

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 5a0d50f4
......@@ -14,4 +14,4 @@ func main() {}
// important: no newline on end of next line.
// 6g used to print <epoch> instead of bug332.go:111
func (t *T) F() {} // ERROR "bug332"
\ No newline at end of file
func (t *T) F() {} // ERROR "undefined: T"
\ No newline at end of file
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment