MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestEventErrorPreservesStreamedText

Function TestEventErrorPreservesStreamedText

internal/tui/tui_test.go:2713–2731  ·  view source on GitHub ↗

TestEventErrorPreservesStreamedText: a stream error mid-content flushes the partial text before appending the error line, same principle as cancel, user keeps the context they were reading.

(t *testing.T)

Source from the content-addressed store, hash-verified

2711 "timeout_seconds": float64(1800), // 10× the old 3-min ceiling
2712 },
2713 })
2714 start := time.Now()
2715 msg := cmd()
2716 elapsed := time.Since(start)
2717
2718 result, ok := msg.(toolResultMsg)
2719 if !ok {
2720 t.Fatalf("expected toolResultMsg, got %T", msg)
2721 }
2722 if !strings.Contains(result.Msg.Content, "through-the-cap") {
2723 t.Fatalf("bash output missing - call may have been killed: %q", result.Msg.Content)
2724 }
2725 if strings.Contains(result.Msg.Content, "timeout") || strings.Contains(result.Msg.Content, "cancelled") {
2726 t.Fatalf("bash should not have been timed-out or cancelled: %q", result.Msg.Content)
2727 }
2728 // Sanity: a fast echo finishes in ms, not minutes, a canary for runToolCall
2729 // re-introducing a blocking outer wrapper.
2730 if elapsed > 10*time.Second {
2731 t.Fatalf("bash took %s - runToolCall is doing more than passing through", elapsed)
2732 }
2733}
2734

Callers

nothing calls this directly

Calls 5

newTestModelFunction · 0.85
stripANSIFunction · 0.85
handleStreamMethod · 0.80
StringMethod · 0.80
activeMethod · 0.80

Tested by

no test coverage detected