TestPartialInputReader_FeedAfterClose is a no-op safety check: after Close, additional fragments are silently dropped rather than re-triggering emit. Prevents races where the SSE loop holds onto the reader past its lifetime.
(t *testing.T)
| 78 | // re-triggering emit. Prevents races where the SSE loop holds onto |
| 79 | // the reader past its lifetime. |
| 80 | func TestPartialInputReader_FeedAfterClose(t *testing.T) { |
| 81 | r := NewPartialInputReader() |
| 82 | emits := 0 |
| 83 | r.OnField = func(_ PartialInputField) { emits++ } |
| 84 | |
| 85 | r.Feed(`{"q":"a"}`) |
| 86 | r.Close() |
| 87 | r.Feed(`{"q":"b","other":"c"}`) |
| 88 | assert.Equal(t, 1, emits, "post-Close Feeds are ignored") |
| 89 | } |
| 90 | |
| 91 | // TestPartialInputReader_HonoursMaxBuffer guards against pathological |
| 92 | // streams (a misbehaving provider sending megabytes of partial JSON). |
nothing calls this directly
no test coverage detected