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

Function TestCRLFLineEndings

internal/tui/prompt_test.go:423–436  ·  view source on GitHub ↗

TestCRLFLineEndings: Windows \r\n counts each line once, not twice.

(t *testing.T)

Source from the content-addressed store, hash-verified

421
422// TestCRLFLineEndings: Windows \r\n counts each line once, not twice.
423func TestCRLFLineEndings(t *testing.T) {
424 p := newChippablePrompt()
425 paste := strings.Repeat("line\r\n", 9) + "end"
426 p, _ = p.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(paste), Paste: true})
427
428 if len(p.spans) != 1 {
429 t.Fatal("CRLF paste should chip")
430 }
431 wantLabel := "[Pasted text +10 lines]"
432 if got := p.DisplayValue(); got != wantLabel {
433 t.Fatalf("label line count wrong for CRLF; got %q want %q",
434 got, wantLabel)
435 }
436}
437
438// TestPasteWithoutFlagButWithNewlineStillChips: some terminals omit the
439// bracketed paste flag, yet multi line content in one KeyMsg can't come from

Callers

nothing calls this directly

Calls 3

newChippablePromptFunction · 0.85
DisplayValueMethod · 0.80
UpdateMethod · 0.45

Tested by

no test coverage detected