MCPcopy Create free account
hub / github.com/diillson/chatcli / TestPartialInputReader_NonObjectIsIgnored

Function TestPartialInputReader_NonObjectIsIgnored

llm/partial_input_test.go:144–152  ·  view source on GitHub ↗

TestPartialInputReader_NonObjectIsIgnored makes sure a streaming payload that doesn't start with { (an array or scalar) does not produce events. Tool inputs are always objects; anything else is almost certainly a bug upstream.

(t *testing.T)

Source from the content-addressed store, hash-verified

142// produce events. Tool inputs are always objects; anything else is
143// almost certainly a bug upstream.
144func TestPartialInputReader_NonObjectIsIgnored(t *testing.T) {
145 r := NewPartialInputReader()
146 emits := 0
147 r.OnField = func(_ PartialInputField) { emits++ }
148 r.Feed(`[1,2,3]`)
149 r.Feed(`"just a string"`)
150 r.Feed(`42`)
151 assert.Equal(t, 0, emits)
152}
153
154// TestPartialInputReader_Snapshot lets diagnostics peek at the
155// internal buffer without disturbing the streaming state.

Callers

nothing calls this directly

Calls 3

FeedMethod · 0.95
NewPartialInputReaderFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected