MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestRightArrowAtChipStartJumpsToEnd

Function TestRightArrowAtChipStartJumpsToEnd

internal/tui/prompt_test.go:155–170  ·  view source on GitHub ↗

TestRightArrowAtChipStartJumpsToEnd: → skips the whole chip in one keystroke.

(t *testing.T)

Source from the content-addressed store, hash-verified

153
154// TestRightArrowAtChipStartJumpsToEnd: → skips the whole chip in one keystroke.
155func TestRightArrowAtChipStartJumpsToEnd(t *testing.T) {
156 p := newChippablePrompt()
157 p, _ = p.Update(pasteKey(makePaste(9)))
158 p.setCursorRuneOffset(p.spans[0].start)
159
160 wantEnd := p.spans[0].end
161 p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRight})
162 after := p.cursorRuneOffset()
163
164 if after != wantEnd {
165 t.Fatalf("→ at chip.start should land at chip.end=%d, got %d", wantEnd, after)
166 }
167 if len(p.spans) != 1 {
168 t.Fatal("→ must not delete the chip")
169 }
170}
171
172// TestTwoChipsTrackedIndependently: two pastes make two chips; deleting the
173// first leaves the second intact with its span shifted left.

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