aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-09-23 20:50:48 -0700
committerRobert Griesemer <gri@golang.org>2021-09-24 04:20:30 +0000
commitaa878ee49b6954a818cc00c26754c84b86a4215b (patch)
tree0c57f7cf9912a830dae2301db7a98a88d6506f62 /src/cmd/compile/internal/syntax
parent483533df9e35eea46747c5545307b230eca997b6 (diff)
downloadgo-aa878ee49b6954a818cc00c26754c84b86a4215b.tar.xz
cmd/compile/internal/syntax: assume generic code for std lib
Also: improve some error message prints in testSyntaxErrors. Change-Id: Iaa1d642398fa82975fefb4bde54f476dd5229eb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/351791 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax')
-rw-r--r--src/cmd/compile/internal/syntax/error_test.go4
-rw-r--r--src/cmd/compile/internal/syntax/parser_test.go7
2 files changed, 4 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/syntax/error_test.go b/src/cmd/compile/internal/syntax/error_test.go
index 30e68ff1d9..0952ddc647 100644
--- a/src/cmd/compile/internal/syntax/error_test.go
+++ b/src/cmd/compile/internal/syntax/error_test.go
@@ -154,11 +154,11 @@ func testSyntaxErrors(t *testing.T, filename string) {
if found {
rx, err := regexp.Compile(pattern)
if err != nil {
- t.Errorf("%s: %v", pos, err)
+ t.Errorf("%s:%s: %v", filename, pos, err)
return
}
if match := rx.MatchString(e.Msg); !match {
- t.Errorf("%s: %q does not match %q", pos, e.Msg, pattern)
+ t.Errorf("%s:%s: %q does not match %q", filename, pos, e.Msg, pattern)
return
}
// we have a match - eliminate this error
diff --git a/src/cmd/compile/internal/syntax/parser_test.go b/src/cmd/compile/internal/syntax/parser_test.go
index 6afe109e1b..04a16e96fe 100644
--- a/src/cmd/compile/internal/syntax/parser_test.go
+++ b/src/cmd/compile/internal/syntax/parser_test.go
@@ -51,10 +51,7 @@ func TestParseGo2(t *testing.T) {
}
}
-func TestStdLib(t *testing.T) { testStdLib(t, 0) }
-func TestStdLibGeneric(t *testing.T) { testStdLib(t, AllowGenerics) }
-
-func testStdLib(t *testing.T, mode Mode) {
+func TestStdLib(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
@@ -93,7 +90,7 @@ func testStdLib(t *testing.T, mode Mode) {
if debug {
fmt.Printf("parsing %s\n", filename)
}
- ast, err := ParseFile(filename, nil, nil, mode)
+ ast, err := ParseFile(filename, nil, nil, AllowGenerics)
if err != nil {
t.Error(err)
return