diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-07 14:06:12 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-07 14:06:12 -0700 |
commit | 480ccfd05a13ac36516c536a71203280a31b4d28 (patch) | |
tree | 4ae21bf95c9f3b4cce97a0a0473fe622fdb393eb /decode_test.go | |
parent | 87013d526ea1b0647ef6e08758fe587cee11d854 (diff) | |
parent | 47549aa3d10808c063d45dcaa598887dadde59c5 (diff) |
Merge branch 'lukeshu/fixup'
Diffstat (limited to 'decode_test.go')
-rw-r--r-- | decode_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/decode_test.go b/decode_test.go index 73ce903..456f363 100644 --- a/decode_test.go +++ b/decode_test.go @@ -5,6 +5,7 @@ package lowmemjson import ( + "bytes" "io" "strings" "testing" @@ -34,3 +35,16 @@ func TestDecodeObject(t *testing.T) { }) assert.ErrorContains(t, err, "did not consume entire") } + +func TestDecodeGrowing(t *testing.T) { + t.Parallel() + var buf bytes.Buffer + dec := NewDecoder(&buf) + var x any + assert.ErrorIs(t, dec.Decode(&x), io.EOF) + buf.WriteString("1\n") + assert.NoError(t, dec.Decode(&x)) + buf.WriteString("1\n") + assert.NoError(t, dec.Decode(&x)) + assert.ErrorIs(t, dec.Decode(&x), io.EOF) +} |