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

Function TestLongSingleLinePasteChipsByCharCount

internal/tui/prompt_test.go:457–468  ·  view source on GitHub ↗

TestLongSingleLinePasteChipsByCharCount: a long single-line blob (zero newlines) still collapses: char threshold catches minified JSON and one-line stack traces that line-count alone would miss.

(t *testing.T)

Source from the content-addressed store, hash-verified

455// newlines) still collapses: char threshold catches minified JSON and
456// one-line stack traces that line-count alone would miss.
457func TestLongSingleLinePasteChipsByCharCount(t *testing.T) {
458 p := newChippablePrompt()
459 big := strings.Repeat("x", 500)
460 p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(big), Paste: true})
461 if len(p.spans) != 1 {
462 t.Fatalf("long single-line paste should chip by char threshold; spans=%+v", p.spans)
463 }
464 wantLabel := "[Pasted text +1 lines]"
465 if got := p.DisplayValue(); got != wantLabel {
466 t.Fatalf("DisplayValue = %q, want %q", got, wantLabel)
467 }
468}
469
470// TestBackspaceImmediatelyAfterChipRemovesIt: atomic-delete regression guard,
471// after a paste the cursor sits at chip.end, so one Backspace deletes the chip

Callers

nothing calls this directly

Calls 3

newChippablePromptFunction · 0.85
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected