You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-15 22:50:24 +02:00
#34 add decoder adapter
This commit is contained in:
19
jsoniter_adapter_test.go
Normal file
19
jsoniter_adapter_test.go
Normal file
@ -0,0 +1,19 @@
|
||||
package jsoniter
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/json-iterator/go/require"
|
||||
"encoding/json"
|
||||
"bytes"
|
||||
)
|
||||
|
||||
func Test_new_decoder(t *testing.T) {
|
||||
should := require.New(t)
|
||||
decoder1 := json.NewDecoder(bytes.NewBufferString(`[1]`))
|
||||
decoder2 := NewDecoder(bytes.NewBufferString(`[1]`))
|
||||
arr1 := []int{}
|
||||
should.Nil(decoder1.Decode(&arr1))
|
||||
should.Equal([]int{1}, arr1)
|
||||
arr2 := []int{}
|
||||
should.Nil(decoder2.Decode(&arr2))
|
||||
}
|
Reference in New Issue
Block a user