aboutsummaryrefslogtreecommitdiff
path: root/lib/bytes/bytes_example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bytes/bytes_example_test.go')
-rw-r--r--lib/bytes/bytes_example_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bytes/bytes_example_test.go b/lib/bytes/bytes_example_test.go
index 141d7f17..bd6b41ea 100644
--- a/lib/bytes/bytes_example_test.go
+++ b/lib/bytes/bytes_example_test.go
@@ -54,6 +54,16 @@ func ExampleEncloseToken() {
// '// Copyright 2016-2018 \"_Shulhan <ms@kilabit.info>\"_. All rights reserved.' true
}
+func ExampleIndexes() {
+ s := []byte("moo moomoo")
+ token := []byte("moo")
+
+ idxs := Indexes(s, token)
+ fmt.Println(idxs)
+ // Output:
+ // [0 4 7]
+}
+
func ExampleIsTokenAt() {
line := []byte("Hello, world")
token := []byte("world")