aboutsummaryrefslogtreecommitdiff
path: root/src/bytes/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytes/example_test.go')
-rw-r--r--src/bytes/example_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go
index 5ba7077c1d..ae93202b57 100644
--- a/src/bytes/example_test.go
+++ b/src/bytes/example_test.go
@@ -30,6 +30,13 @@ func ExampleBuffer_reader() {
// Output: Gophers rule!
}
+func ExampleBuffer_Bytes() {
+ buf := bytes.Buffer{}
+ buf.Write([]byte{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'})
+ os.Stdout.Write(buf.Bytes())
+ // Output: hello world
+}
+
func ExampleBuffer_Grow() {
var b bytes.Buffer
b.Grow(64)