aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/bytes/bytes_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
-rw-r--r--src/pkg/bytes/bytes_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go
index 553ceb7c5a..3f77e6e9ff 100644
--- a/src/pkg/bytes/bytes_test.go
+++ b/src/pkg/bytes/bytes_test.go
@@ -365,6 +365,19 @@ func TestMap(t *testing.T) {
if string(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, Bytes("Hello, 세계"));
+ expect = "Hello";
+ if string(m) != expect {
+ t.Errorf("drop: expected %q got %q", expect, m)
+ }
}
func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) }