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>
diff --git a/go/analysis/analysistest/analysistest_test.go b/go/analysis/analysistest/analysistest_test.go
index 38dfd7a..bc07051 100644
--- a/go/analysis/analysistest/analysistest_test.go
+++ b/go/analysis/analysistest/analysistest_test.go
@@ -73,12 +73,18 @@
 		`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"),