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

Function TestCarriageReturnLineEndings

internal/tui/prompt_test.go:406–420  ·  view source on GitHub ↗

TestCarriageReturnLineEndings: lone-\r separators (old-mac-style, some VS Code TERM setups) must still yield a correct chip line count. bubbles/textarea splits only on \n, so we count separators ourselves.

(t *testing.T)

Source from the content-addressed store, hash-verified

404// TERM setups) must still yield a correct chip line count. bubbles/textarea
405// splits only on \n, so we count separators ourselves.
406func TestCarriageReturnLineEndings(t *testing.T) {
407 p := newChippablePrompt()
408 // 10-line paste, \r separators only.
409 paste := strings.Repeat("line\r", 9) + "end"
410 p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(paste), Paste: true})
411
412 if len(p.spans) != 1 {
413 t.Fatalf("\\r-separated paste should still chip; spans=%+v", p.spans)
414 }
415 wantLabel := "[Pasted text +10 lines]"
416 if got := p.DisplayValue(); got != wantLabel {
417 t.Fatalf("label should report the real line count; got %q want %q",
418 got, wantLabel)
419 }
420}
421
422// TestCRLFLineEndings: Windows \r\n counts each line once, not twice.
423func TestCRLFLineEndings(t *testing.T) {

Callers

nothing calls this directly

Calls 3

newChippablePromptFunction · 0.85
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected