aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/pktline/scanner_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:33:16 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2021-05-02 23:33:16 +0200
commitc69d5331743e49d3672897cf1c552e5e123d4509 (patch)
treedf503db7e8889cef313641b31808fc7404b400e3 /plumbing/format/pktline/scanner_test.go
parent67d34902b0c41ee5d6d283f4c5b6c2ad7db123fd (diff)
downloadgo-git-c69d5331743e49d3672897cf1c552e5e123d4509.tar.gz
plumbing: format, use os.UserHomeDir()
Diffstat (limited to 'plumbing/format/pktline/scanner_test.go')
-rw-r--r--plumbing/format/pktline/scanner_test.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/plumbing/format/pktline/scanner_test.go b/plumbing/format/pktline/scanner_test.go
index 479ad77..60b6224 100644
--- a/plumbing/format/pktline/scanner_test.go
+++ b/plumbing/format/pktline/scanner_test.go
@@ -217,34 +217,3 @@ func sectionsExample(c *C, nSections, nLines int) io.Reader {
return &buf
}
-
-func ExampleScanner() {
- // A reader is needed as input.
- input := strings.NewReader("000ahello\n" +
- "000bworld!\n" +
- "0000",
- )
-
- // Create the scanner...
- s := pktline.NewScanner(input)
-
- // and scan every pkt-line found in the input.
- for s.Scan() {
- payload := s.Bytes()
- if len(payload) == 0 { // zero sized payloads correspond to flush-pkts.
- fmt.Println("FLUSH-PKT DETECTED")
- } else { // otherwise, you will be able to access the full payload.
- fmt.Printf("PAYLOAD = %q\n", string(payload))
- }
- }
-
- // this will catch any error when reading from the input, if any.
- if s.Err() != nil {
- fmt.Println(s.Err())
- }
-
- // Output:
- // PAYLOAD = "hello\n"
- // PAYLOAD = "world!\n"
- // FLUSH-PKT DETECTED
-}