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)
| 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. |
| 1087 | func 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, |
nothing calls this directly
no test coverage detected