summaryrefslogtreecommitdiffstats
path: root/libgo/go/regexp/find_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/regexp/find_test.go')
-rw-r--r--libgo/go/regexp/find_test.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libgo/go/regexp/find_test.go b/libgo/go/regexp/find_test.go
index 07f5586f2b3..1690711dd78 100644
--- a/libgo/go/regexp/find_test.go
+++ b/libgo/go/regexp/find_test.go
@@ -78,6 +78,7 @@ var findTests = []FindTest{
{`axxb$`, "axxcb", nil},
{`data`, "daXY data", build(1, 5, 9)},
{`da(.)a$`, "daXY data", build(1, 5, 9, 7, 8)},
+ {`zx+`, "zzx", build(1, 1, 3)},
// can backslash-escape any punctuation
{`\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\{\|\}\~`,
@@ -119,7 +120,11 @@ func build(n int, x ...int) [][]int {
func TestFind(t *testing.T) {
for _, test := range findTests {
- result := MustCompile(test.pat).Find([]byte(test.text))
+ re := MustCompile(test.pat)
+ if re.String() != test.pat {
+ t.Errorf("String() = `%s`; should be `%s`", re.String(), test.pat)
+ }
+ result := re.Find([]byte(test.text))
switch {
case len(test.matches) == 0 && len(result) == 0:
// ok
OpenPOWER on IntegriCloud