From 05d253c83ec748b9566f592126e37774f741a2eb Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Tue, 12 Feb 2019 14:22:52 -0500 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Rebecca Stambler --- go/analysis/analysistest/analysistest_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/go/analysis/analysistest/analysistest_test.go b/go/analysis/analysistest/analysistest_test.go index 38dfd7acf0a..bc070512bf0 100644 --- a/go/analysis/analysistest/analysistest_test.go +++ b/go/analysis/analysistest/analysistest_test.go @@ -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"),