MCPcopy Index your code
hub / github.com/maruel/panicparse / TestLineToByteOffsets

Function TestLineToByteOffsets

stack/source_test.go:1584–1600  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1582}
1583
1584func TestLineToByteOffsets(t *testing.T) {
1585 src := "\n\n\n"
1586 want := []int{0, 0, 1, 2, 3}
1587 if diff := cmp.Diff(want, lineToByteOffsets([]byte(src))); diff != "" {
1588 t.Error(diff)
1589 }
1590 src = "hello"
1591 want = []int{0, 0}
1592 if diff := cmp.Diff(want, lineToByteOffsets([]byte(src))); diff != "" {
1593 t.Error(diff)
1594 }
1595 src = "this\nis\na\ntest"
1596 want = []int{0, 0, 5, 8, 10}
1597 if diff := cmp.Diff(want, lineToByteOffsets([]byte(src))); diff != "" {
1598 t.Error(diff)
1599 }
1600}
1601
1602//
1603

Callers

nothing calls this directly

Calls 1

lineToByteOffsetsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…