summaryrefslogtreecommitdiffstats
path: root/libgo/go/strings/replace_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/strings/replace_test.go')
-rw-r--r--libgo/go/strings/replace_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libgo/go/strings/replace_test.go b/libgo/go/strings/replace_test.go
index d33dea95b09..82e4b6ef08e 100644
--- a/libgo/go/strings/replace_test.go
+++ b/libgo/go/strings/replace_test.go
@@ -261,10 +261,21 @@ func TestReplacer(t *testing.T) {
testCases = append(testCases,
testCase{abcMatcher, "", ""},
testCase{abcMatcher, "ab", "ab"},
+ testCase{abcMatcher, "abc", "[match]"},
testCase{abcMatcher, "abcd", "[match]d"},
testCase{abcMatcher, "cabcabcdabca", "c[match][match]d[match]a"},
)
+ // Issue 6659 cases (more single string replacer)
+
+ noHello := NewReplacer("Hello", "")
+ testCases = append(testCases,
+ testCase{noHello, "Hello", ""},
+ testCase{noHello, "Hellox", "x"},
+ testCase{noHello, "xHello", "x"},
+ testCase{noHello, "xHellox", "xx"},
+ )
+
// No-arg test cases.
nop := NewReplacer()
OpenPOWER on IntegriCloud