TestSessionTokensSurviveFinalizeTurn: finalizeTurn clears turnTokens but must NOT touch sessionTokens. turnStart must be set or finalizeTurn no-ops.
(t *testing.T)
| 1678 | // Simulate three Done events. phase must be active or handleStream will |
| 1679 | // (correctly) drop events as stale post-cancel buffer: EventDone does |
| 1680 | // not move phase, so we seed streaming once and let each Done carry |
| 1681 | // through. |
| 1682 | m.phase = phaseStreaming |
| 1683 | for _, n := range []int{7, 13, 22} { |
| 1684 | out, _ := m.handleStream(llm.Event{Kind: llm.EventDone, Tokens: n}) |
| 1685 | m = out.(Model) |
| 1686 | } |
| 1687 | if m.sessionTokens != 7+13+22 { |
| 1688 | t.Fatalf("session counter should sum all Done events: got %d, want %d", |
| 1689 | m.sessionTokens, 7+13+22) |
| 1690 | } |
| 1691 | if m.turnTokens != 7+13+22 { |
| 1692 | // Without a streamClosedMsg between events, turnTokens keeps summing |
| 1693 | // too, verifying the two counters are in lockstep before finalize. |
| 1694 | t.Fatalf("precondition: turn counter should equal session before finalize, got %d", m.turnTokens) |
| 1695 | } |
| 1696 | } |
| 1697 | |
| 1698 | // TestSessionTokensSurviveFinalizeTurn: finalizeTurn clears turnTokens but |
nothing calls this directly
no test coverage detected