MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestLeftArrowAtChipEndJumpsToStart

Function TestLeftArrowAtChipEndJumpsToStart

internal/tui/prompt_test.go:133–152  ·  view source on GitHub ↗

TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip in one keystroke; it never lands on interior positions.

(t *testing.T)

Source from the content-addressed store, hash-verified

131// TestLeftArrowAtChipEndJumpsToStart: ← jumps the cursor across the whole chip
132// in one keystroke; it never lands on interior positions.
133func TestLeftArrowAtChipEndJumpsToStart(t *testing.T) {
134 p := newChippablePrompt()
135 p, _ = p.Update(pasteKey(makePaste(9)))
136 p.setCursorRuneOffset(p.spans[0].end)
137
138 before := p.cursorRuneOffset()
139 wantStart := p.spans[0].start
140 p, _ = p.Update(tea.KeyMsg{Type: tea.KeyLeft})
141 after := p.cursorRuneOffset()
142
143 if before == after {
144 t.Fatal("← should have moved the cursor")
145 }
146 if after != wantStart {
147 t.Fatalf("← at chip.end should land at chip.start=%d, got %d", wantStart, after)
148 }
149 if len(p.spans) != 1 {
150 t.Fatal("← must not delete the chip")
151 }
152}
153
154// TestRightArrowAtChipStartJumpsToEnd: → skips the whole chip in one keystroke.
155func TestRightArrowAtChipStartJumpsToEnd(t *testing.T) {

Callers

nothing calls this directly

Calls 6

newChippablePromptFunction · 0.85
pasteKeyFunction · 0.85
makePasteFunction · 0.85
setCursorRuneOffsetMethod · 0.80
cursorRuneOffsetMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected