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

Function TestVisualPromptLinesSumsAcrossLogicalLines

internal/tui/tui_test.go:2357–2369  ·  view source on GitHub ↗

TestVisualPromptLinesSumsAcrossLogicalLines: visualPromptLines splits on newlines and sums wrapRows for each segment: the prompt field grows to hold the combined visual height.

(t *testing.T)

Source from the content-addressed store, hash-verified

2355}
2356
2357// TestHandleStreamDrainsAfterCancel: buffered stream events can arrive after
2358// Ctrl+C returned phase to idle. Processing them would write ghost tokens, re
2359// populate m.pending, and credit a cancelled turn's usage to sessionTokens.
2360// handleStream must drain only.
2361func TestHandleStreamDrainsAfterCancel(t *testing.T) {
2362 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
2363 m.phase = phaseIdle // post cancel state
2364 m.sessionTokens = 100
2365
2366 out, _ := m.handleStream(llm.Event{Kind: llm.EventContent, Content: "ghost"})
2367 om := out.(Model)
2368 if om.streaming.Len() != 0 {
2369 t.Fatalf("stale EventContent wrote to streaming: %q", om.streaming.String())
2370 }
2371 out, _ = om.handleStream(llm.Event{Kind: llm.EventToolCall, ToolCall: &chmctx.ToolCall{ID: "c", Name: "bash"}})
2372 om = out.(Model)

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
SetValueMethod · 0.80
visualPromptLinesMethod · 0.80

Tested by

no test coverage detected