(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func 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 := ` |
| 66 | hello x goodbye |
| 67 | hell 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 | |
| 78 | func TestOffsets(t *testing.T) { |
| 79 | b := makeBufferForTesting(10, 3) |
nothing calls this directly
no test coverage detected