]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: change ExampleReader_Len to use a non-ASCII string
authorRuss Cox <rsc@golang.org>
Tue, 14 Nov 2017 02:20:23 +0000 (21:20 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Nov 2017 21:25:07 +0000 (21:25 +0000)
This should help make clear that Len is not counting runes.
Also delete empty string, which doesn't add much.

Change-Id: I1602352df1897fef6e855e9db0bababb8ab788ca
Reviewed-on: https://go-review.googlesource.com/78110
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
src/bytes/example_test.go

index 6a7ce59f55b84d0564e509cb6884efbd7d655250..9921a207b1df9184d91946909ecda2a2e4011832 100644 (file)
@@ -430,11 +430,9 @@ func ExampleToLower() {
 }
 
 func ExampleReader_Len() {
-       fmt.Println(bytes.NewReader([]byte("")).Len())
        fmt.Println(bytes.NewReader([]byte("Hi!")).Len())
-       fmt.Println(bytes.NewReader([]byte("Hello Gopher!")).Len())
+       fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len())
        // Output:
-       // 0
        // 3
-       // 13
+       // 16
 }