aboutsummaryrefslogtreecommitdiff
path: root/src/unicode
diff options
context:
space:
mode:
Diffstat (limited to 'src/unicode')
-rw-r--r--src/unicode/utf8/example_test.go10
-rw-r--r--src/unicode/utf8/utf8_test.go2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/unicode/utf8/example_test.go b/src/unicode/utf8/example_test.go
index 5cd931d242..fe434c9476 100644
--- a/src/unicode/utf8/example_test.go
+++ b/src/unicode/utf8/example_test.go
@@ -214,3 +214,13 @@ func ExampleValidString() {
// true
// false
}
+
+func ExampleAppendRune() {
+ buf1 := utf8.AppendRune(nil, 0x10000)
+ buf2 := utf8.AppendRune([]byte("init"), 0x10000)
+ fmt.Println(string(buf1))
+ fmt.Println(string(buf2))
+ // Output:
+ // ๐€€
+ // init๐€€
+}
diff --git a/src/unicode/utf8/utf8_test.go b/src/unicode/utf8/utf8_test.go
index a60040ecfd..e9be4d2d63 100644
--- a/src/unicode/utf8/utf8_test.go
+++ b/src/unicode/utf8/utf8_test.go
@@ -133,7 +133,7 @@ func TestAppendRune(t *testing.T) {
t.Errorf("AppendRune(nil, %#04x) = %s, want %s", m.r, buf, m.str)
}
if buf := AppendRune([]byte("init"), m.r); string(buf) != "init"+m.str {
- t.Errorf("AppendRune(nil, %#04x) = %s, want %s", m.r, buf, "init"+m.str)
+ t.Errorf("AppendRune(init, %#04x) = %s, want %s", m.r, buf, "init"+m.str)
}
}
}