TestPartialInputReader_DoesNotEmitTwice pins the dedup contract: once a field has been surfaced, subsequent re-parses (because more fragments arrived) must not re-emit it.
(t *testing.T)
| 37 | // once a field has been surfaced, subsequent re-parses (because more |
| 38 | // fragments arrived) must not re-emit it. |
| 39 | func TestPartialInputReader_DoesNotEmitTwice(t *testing.T) { |
| 40 | r := NewPartialInputReader() |
| 41 | emits := 0 |
| 42 | r.OnField = func(_ PartialInputField) { emits++ } |
| 43 | |
| 44 | r.Feed(`{"url":"https://example.com"}`) |
| 45 | r.Feed("") // no-op |
| 46 | r.Feed(`{"url":"https://example.com","extra":1}`) |
| 47 | // The reader resets on each Feed by re-parsing the full buffer |
| 48 | // — but the emitted map ensures one fire per field. |
| 49 | assert.Equal(t, 1, emits, "the same field never re-emits") |
| 50 | } |
| 51 | |
| 52 | // TestPartialInputReader_MultipleStringFields covers the common shape |
| 53 | // produced by @coder exec: cmd + cwd in one envelope. |
nothing calls this directly
no test coverage detected