summaryrefslogtreecommitdiff
path: root/lib/bytes/parser_example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bytes/parser_example_test.go')
-rw-r--r--lib/bytes/parser_example_test.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/bytes/parser_example_test.go b/lib/bytes/parser_example_test.go
index 2a1c6d8c..b6582542 100644
--- a/lib/bytes/parser_example_test.go
+++ b/lib/bytes/parser_example_test.go
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2023 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
+
package bytes_test
import (
@@ -219,15 +223,21 @@ func ExampleParser_SkipLine() {
)
parser.SkipLine()
- token, _ := parser.Read()
- fmt.Printf("token:'%s'\n", token)
+ token, c := parser.Read()
+ fmt.Printf("token=%q c=%q\n", token, c)
parser.SkipLine()
- token, _ = parser.Read()
- fmt.Printf("token:'%s'\n", token)
+ token, c = parser.Read()
+ fmt.Printf("token=%q c=%q\n", token, c)
+
+ parser.SkipLine()
+ token, c = parser.Read()
+ fmt.Printf("token=%q c=%q\n", token, c)
+
// Output:
- // token:'b'
- // token:'d e'
+ // token="b" c='\n'
+ // token="d e" c='\n'
+ // token="" c='\x00'
}
func ExampleParser_SkipN() {