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

Function TestToolArgsStreamBumpsEstimateAndPhase

internal/tui/tui_test.go:1086–1097  ·  view source on GitHub ↗

TestToolArgsStreamBumpsEstimateAndPhase: a tool-call argument fragment (a file streaming into write_file) ticks the live token estimate AND flips the phase to "generating", so the counter doesn't freeze through a long file write: the bug where only chat content and reasoning were counted, not tool a

(t *testing.T)

Source from the content-addressed store, hash-verified

1084// streaming into write_file) ticks the live token estimate AND flips the phase
1085// to "generating", so the counter doesn't freeze through a long file write: the
1086// bug where only chat content and reasoning were counted, not tool arguments.
1087func TestToolArgsStreamBumpsEstimateAndPhase(t *testing.T) {
1088 m := newTestModel(t, func(http.ResponseWriter, *http.Request) {})
1089 m.phase = phaseThinking // a tool-only round starts here, before any content
1090 out, _ := m.handleStream(llm.Event{Kind: llm.EventToolArgs, Content: strings.Repeat("x", 40)})
1091 m = out.(Model)
1092 if m.phase != phaseStreaming {
1093 t.Fatalf("EventToolArgs should flip thinking→generating, phase=%v", m.phase)
1094 }
1095 if m.streamingEstimate != 10 { // 40 chars / 4
1096 t.Fatalf("EventToolArgs should bump the estimate by len/4, got %d", m.streamingEstimate)
1097 }
1098}
1099
1100// TestBuildToolsExposesExactlyFourTools pins the tool roster: bash, read_file,

Callers

nothing calls this directly

Calls 2

newTestModelFunction · 0.85
handleStreamMethod · 0.80

Tested by

no test coverage detected