aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings_test.go
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2018-10-15 17:09:34 -0400
committerFilippo Valsorda <filippo@golang.org>2018-10-15 17:09:34 -0400
commit623650b27aa42dd2ccd20fc4a79f8fe7b8559987 (patch)
treebfafa16d1bfd57fc1d9831c22e6e236be3d52281 /src/strings/strings_test.go
parent36c789b1fd72af5ff6e756794597a3a85e069998 (diff)
parent1961d8d72a53e780effa18bfa8dbe4e4282df0b2 (diff)
downloadgo-623650b27aa42dd2ccd20fc4a79f8fe7b8559987.tar.xz
[dev.boringcrypto] all: merge master into dev.boringcrypto
Change-Id: I218ba1b89a2df6e4335c6a5846889d9a04affe5d
Diffstat (limited to 'src/strings/strings_test.go')
-rw-r--r--src/strings/strings_test.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go
index 20bc484f39..eee2dd55df 100644
--- a/src/strings/strings_test.go
+++ b/src/strings/strings_test.go
@@ -646,10 +646,10 @@ func TestMap(t *testing.T) {
if unicode.Is(unicode.Latin, r) {
return r
}
- return '?'
+ return utf8.RuneError
}
m = Map(replaceNotLatin, "Hello\255World")
- expect = "Hello?World"
+ expect = "Hello\uFFFDWorld"
if m != expect {
t.Errorf("replace invalid sequence: expected %q got %q", expect, m)
}
@@ -1243,6 +1243,12 @@ func TestReplace(t *testing.T) {
if s := Replace(tt.in, tt.old, tt.new, tt.n); s != tt.out {
t.Errorf("Replace(%q, %q, %q, %d) = %q, want %q", tt.in, tt.old, tt.new, tt.n, s, tt.out)
}
+ if tt.n == -1 {
+ s := ReplaceAll(tt.in, tt.old, tt.new)
+ if s != tt.out {
+ t.Errorf("ReplaceAll(%q, %q, %q) = %q, want %q", tt.in, tt.old, tt.new, s, tt.out)
+ }
+ }
}
}