summaryrefslogtreecommitdiff
path: root/src/pkg/strings/strings_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/strings/strings_test.go')
-rw-r--r--src/pkg/strings/strings_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/strings/strings_test.go b/src/pkg/strings/strings_test.go
index ce77c5c2f..e3e7f38ae 100644
--- a/src/pkg/strings/strings_test.go
+++ b/src/pkg/strings/strings_test.go
@@ -279,6 +279,19 @@ func TestMap(t *testing.T) {
if m != expect {
t.Errorf("rot13: expected %q got %q", expect, m)
}
+
+ // 5. Drop
+ dropNotLatin := func(rune int) int {
+ if unicode.Is(unicode.Latin, rune) {
+ return rune
+ }
+ return -1;
+ };
+ m = Map(dropNotLatin, "Hello, 세계");
+ expect = "Hello";
+ if m != expect {
+ t.Errorf("drop: expected %q got %q", expect, m)
+ }
}
func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) }