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

Function TestHumanIntFormat

internal/tui/tui_test.go:1546–1563  ·  view source on GitHub ↗

TestHumanIntFormat: thin-comma formatting must handle the edge cases the activation line cares about: single digits, exact 4-digit, exact powers, and very large windows that would otherwise read as a wall of digits.

(t *testing.T)

Source from the content-addressed store, hash-verified

1544 }
1545 o3, _ := m2.Update(tea.KeyMsg{Type: tea.KeyEnter})
1546 if got := o3.(Model).ta.Value(); got != "" {
1547 t.Fatalf("Enter after Ctrl+L must be a no-op, got ghost completion %q", got)
1548 }
1549}
1550
1551// TestAltEnterInsertsNewline: Alt+Enter composes a multi-line prompt. The
1552// alt-flagged KeyEnter ("alt+enter") matches no textarea binding, so the flag
1553// must be stripped before forwarding or the key is a silent no-op and
1554// multi-line prompts can only be pasted.
1555func TestAltEnterInsertsNewline(t *testing.T) {
1556 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1557 m.ta.SetValue("first line")
1558 out, _ := m.Update(tea.KeyMsg{Type: tea.KeyEnter, Alt: true})
1559 om := out.(Model)
1560 if got := om.ta.Value(); got != "first line\n" {
1561 t.Fatalf("Alt+Enter must insert a newline, got %q", got)
1562 }
1563 if len(om.history) != 0 {
1564 t.Fatal("Alt+Enter must not submit the prompt")
1565 }
1566}

Callers

nothing calls this directly

Calls 1

humanIntFunction · 0.85

Tested by

no test coverage detected