MCPcopy
hub / github.com/liamg/darktile / TestTabbing

Function TestTabbing

internal/app/darktile/termutil/buffer_test.go:49–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestTabbing(t *testing.T) {
50 b := makeBufferForTesting(30, 3)
51 writeRaw(b, []rune("hello")...)
52 b.tab()
53 writeRaw(b, []rune("x")...)
54 b.tab()
55 writeRaw(b, []rune("goodbye")...)
56 b.carriageReturn()
57 b.newLine()
58 writeRaw(b, []rune("hell")...)
59 b.tab()
60 writeRaw(b, []rune("xxx")...)
61 b.tab()
62 writeRaw(b, []rune("good")...)
63 b.carriageReturn()
64 b.newLine()
65 expected := `
66hello x goodbye
67hell xxx good
68`
69
70 lines := b.GetVisibleLines()
71 strs := []string{}
72 for _, l := range lines {
73 strs = append(strs, l.String())
74 }
75 require.Equal(t, strings.TrimSpace(expected), strings.TrimSpace(strings.Join(strs, "\n")))
76}
77
78func TestOffsets(t *testing.T) {
79 b := makeBufferForTesting(10, 3)

Callers

nothing calls this directly

Calls 7

makeBufferForTestingFunction · 0.85
writeRawFunction · 0.85
tabMethod · 0.80
carriageReturnMethod · 0.80
newLineMethod · 0.80
GetVisibleLinesMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected