TestToolCallFlushesStreamedContent: a tool-call event ends the content phase. Whatever streamed before it is rendered and committed *now*, so the user sees styled text *before* the inline tool-call status, not all at once at turn end.
(t *testing.T)
| 2493 | } |
| 2494 | if !strings.Contains(om.View(), "hello world") { |
| 2495 | t.Fatalf("View must show live text during stream: %q", om.View()) |
| 2496 | } |
| 2497 | } |
| 2498 | |
| 2499 | // TestEventDoneFlushesStreamingThroughGlamour: EventDone moves raw streamed |
| 2500 | // text into the committed scroll via the Markdown renderer and empties the |
| 2501 | // streaming buffer. After Done, scroll contains the rendered block and the |
| 2502 | // streaming buffer is empty. |
| 2503 | func TestEventDoneFlushesStreamingThroughGlamour(t *testing.T) { |
| 2504 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 2505 | m.phase = phaseStreaming |
| 2506 | m.streaming.WriteString("done message") |
| 2507 | out, _ := m.handleStream(llm.Event{Kind: llm.EventDone, Final: &chmctx.Message{Role: chmctx.RoleAssistant, Content: "done message"}}) |
| 2508 | om := out.(Model) |
| 2509 | if om.streaming.Len() != 0 { |
| 2510 | t.Fatalf("streaming should be empty after Done, got %q", om.streaming.String()) |
| 2511 | } |
| 2512 | if !strings.Contains(stripANSI(om.scroll.String()), "done message") { |
| 2513 | t.Fatalf("rendered content should be in scroll: %q", om.scroll.String()) |
| 2514 | } |
nothing calls this directly
no test coverage detected