aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/pktline/encoder_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format/pktline/encoder_test.go')
-rw-r--r--plumbing/format/pktline/encoder_test.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/plumbing/format/pktline/encoder_test.go b/plumbing/format/pktline/encoder_test.go
index 4a7c7b8..a6addd6 100644
--- a/plumbing/format/pktline/encoder_test.go
+++ b/plumbing/format/pktline/encoder_test.go
@@ -2,7 +2,6 @@ package pktline_test
import (
"bytes"
- "os"
"strings"
"testing"
@@ -211,39 +210,3 @@ func (s *SuiteEncoder) TestEncodef(c *C) {
expected := []byte("000c foo 42\n")
c.Assert(buf.Bytes(), DeepEquals, expected)
}
-
-func ExampleEncoder() {
- // Create an encoder that writes pktlines to stdout.
- e := pktline.NewEncoder(os.Stdout)
-
- // Encode some data as a new pkt-line.
- _ = e.Encode([]byte("data\n")) // error checks removed for brevity
-
- // Encode a flush-pkt.
- _ = e.Flush()
-
- // Encode a couple of byte slices and a flush in one go. Each of
- // them will end up as payloads of their own pktlines.
- _ = e.Encode(
- []byte("hello\n"),
- []byte("world!\n"),
- pktline.Flush,
- )
-
- // You can also encode strings:
- _ = e.EncodeString(
- "foo\n",
- "bar\n",
- pktline.FlushString,
- )
-
- // You can also format and encode a payload:
- _ = e.Encodef(" %s %d\n", "foo", 42)
- // Output:
- // 0009data
- // 0000000ahello
- // 000bworld!
- // 00000008foo
- // 0008bar
- // 0000000c foo 42
-}