1
0
mirror of https://github.com/golang/go synced 2024-11-18 23:05:06 -07:00

go/analysis/analysistest: change error message checked in expectation

text/scanner now uses the word "invalid" instead of "illegal".
See golang.org/cl/161199

Change-Id: I7db0ea2628760cba5c993bdec6e15e76b20b0e06
Reviewed-on: https://go-review.googlesource.com/c/162137
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Michael Matloob 2019-02-12 14:22:52 -05:00
parent 44bee7e801
commit 05d253c83e

View File

@ -73,12 +73,18 @@ func println(...interface{}) { println() } // want println:"found" "call of prin
`a/b.go:5: in 'want' comment: unexpected ":"`,
`a/b.go:6: in 'want' comment: got String after foo, want ':'`,
`a/b.go:7: in 'want' comment: got EOF, want regular expression`,
`a/b.go:8: in 'want' comment: illegal char escape`,
`a/b.go:8: in 'want' comment: invalid char escape`,
`a/b.go:11:9: diagnostic "call of println(...)" does not match pattern "wrong expectation text"`,
`a/b.go:14:9: unexpected diagnostic: call of println(...)`,
`a/b.go:11: no diagnostic was reported matching "wrong expectation text"`,
`a/b.go:17: no diagnostic was reported matching "unsatisfied expectation"`,
}
// Go 1.13's scanner error messages uses the word invalid where Go 1.12 used illegal. Convert them
// to keep tests compatible with both.
// TODO(matloob): Remove this once Go 1.13 is released.
for i := range got {
got[i] = strings.Replace(got[i], "illegal", "invalid", -1)
} //
if !reflect.DeepEqual(got, want) {
t.Errorf("got:\n%s\nwant:\n%s",
strings.Join(got, "\n"),