1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/shurcooL/go/reflectsource/indicies_test.go

32 lines
429 B
Go
Raw Normal View History

2017-10-03 21:43:55 +03:00
package reflectsource
import (
"fmt"
)
func Example_getLineStartEndIndicies() {
b := []byte(`this
this is a longer line
and
stuff
last`)
for lineIndex := 0; ; lineIndex++ {
s, e := getLineStartEndIndicies(b, lineIndex)
fmt.Printf("%v: [%v, %v]\n", lineIndex, s, e)
if s == -1 {
break
}
}
// Output:
// 0: [0, 4]
// 1: [5, 5]
// 2: [6, 27]
// 3: [28, 31]
// 4: [32, 37]
// 5: [38, 42]
// 6: [-1, -1]
}