mirror of
https://github.com/json-iterator/go.git
synced 2025-04-20 11:28:49 +02:00
fix #261 should load from reader
This commit is contained in:
parent
f89479f5c0
commit
a949c42748
@ -77,7 +77,10 @@ func (adapter *Decoder) Decode(obj interface{}) error {
|
|||||||
|
|
||||||
// More is there more?
|
// More is there more?
|
||||||
func (adapter *Decoder) More() bool {
|
func (adapter *Decoder) More() bool {
|
||||||
return adapter.iter.head != adapter.iter.tail
|
if adapter.iter.head != adapter.iter.tail {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return adapter.iter.loadMore()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buffered remaining buffer
|
// Buffered remaining buffer
|
||||||
|
@ -56,3 +56,9 @@ func Test_use_number(t *testing.T) {
|
|||||||
should.Nil(decoder2.Decode(&obj2))
|
should.Nil(decoder2.Decode(&obj2))
|
||||||
should.Equal(json.Number("123"), obj2)
|
should.Equal(json.Number("123"), obj2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_decoder_more(t *testing.T) {
|
||||||
|
should := require.New(t)
|
||||||
|
decoder := jsoniter.NewDecoder(bytes.NewBufferString("abcde"))
|
||||||
|
should.True(decoder.More())
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user