mirror of
https://github.com/json-iterator/go.git
synced 2024-11-24 08:22:14 +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?
|
||||
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
|
||||
|
@ -56,3 +56,9 @@ func Test_use_number(t *testing.T) {
|
||||
should.Nil(decoder2.Decode(&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…
Reference in New Issue
Block a user