constraints: update test to match old and new constraint error messages
The compiler now uses the phrase "does not satisfy" when a constraint
is not satisfied by a type parameter (before 1.20 it used the phrase
"does not implement").
Fixes golang/go#57615.
Change-Id: Ibc8461b2f293393f4f7cac7d330bb863b3a15c28
Reviewed-on: https://go-review.googlesource.com/c/exp/+/460460
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/constraints/constraints_test.go b/constraints/constraints_test.go
index 5bc43a9..28af970 100644
--- a/constraints/constraints_test.go
+++ b/constraints/constraints_test.go
@@ -5,11 +5,11 @@
package constraints
import (
- "bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
+ "regexp"
"runtime"
"testing"
)
@@ -148,9 +148,8 @@
t.Error("build succeeded, but expected to fail")
} else if len(out) > 0 {
t.Logf("%s", out)
- const want = "does not implement"
- if !bytes.Contains(out, []byte(want)) {
- t.Errorf("output does not include %q", want)
+ if !wantRx.Match(out) {
+ t.Errorf("output does not match %q", wantRx)
}
} else {
t.Error("no error output, expected something")
@@ -158,3 +157,5 @@
})
}
}
+
+var wantRx = regexp.MustCompile("does not (implement|satisfy)")