MCPcopy
hub / github.com/micro-editor/micro / TestSplit

Function TestSplit

internal/buffer/line_array_test.go:23–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestSplit(t *testing.T) {
24 la.insert(Loc{17, 1}, []byte{'\n'})
25 assert.Equal(t, len(la.lines), 6)
26 sub1 := la.Substr(Loc{0, 1}, Loc{17, 1})
27 sub2 := la.Substr(Loc{0, 2}, Loc{30, 2})
28
29 assert.Equal(t, []byte("He wes Leovenaðes"), sub1)
30 assert.Equal(t, []byte(" sone -- liðe him be Drihten."), sub2)
31}
32
33func TestJoin(t *testing.T) {
34 la.remove(Loc{47, 1}, Loc{0, 2})

Callers

nothing calls this directly

Calls 2

SubstrMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected