aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/errors/errors_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/cgo/errors/errors_test.go')
-rw-r--r--misc/cgo/errors/errors_test.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/misc/cgo/errors/errors_test.go b/misc/cgo/errors/errors_test.go
index 9718b7f9fb..8168032dc3 100644
--- a/misc/cgo/errors/errors_test.go
+++ b/misc/cgo/errors/errors_test.go
@@ -36,16 +36,23 @@ func check(t *testing.T, file string) {
continue
}
- _, frag, ok := bytes.Cut(line, []byte("ERROR HERE: "))
- if !ok {
- continue
+ if _, frag, ok := bytes.Cut(line, []byte("ERROR HERE: ")); ok {
+ re, err := regexp.Compile(fmt.Sprintf(":%d:.*%s", i+1, frag))
+ if err != nil {
+ t.Errorf("Invalid regexp after `ERROR HERE: `: %#q", frag)
+ continue
+ }
+ errors = append(errors, re)
}
- re, err := regexp.Compile(fmt.Sprintf(":%d:.*%s", i+1, frag))
- if err != nil {
- t.Errorf("Invalid regexp after `ERROR HERE: `: %#q", frag)
- continue
+
+ if _, frag, ok := bytes.Cut(line, []byte("ERROR MESSAGE: ")); ok {
+ re, err := regexp.Compile(string(frag))
+ if err != nil {
+ t.Errorf("Invalid regexp after `ERROR MESSAGE: `: %#q", frag)
+ continue
+ }
+ errors = append(errors, re)
}
- errors = append(errors, re)
}
if len(errors) == 0 {
t.Fatalf("cannot find ERROR HERE")
@@ -106,6 +113,7 @@ func TestReportsTypeErrors(t *testing.T) {
for _, file := range []string{
"err1.go",
"err2.go",
+ "err5.go",
"issue11097a.go",
"issue11097b.go",
"issue18452.go",