1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

#30 support json.Number

This commit is contained in:
Tao Wen
2017-06-02 10:21:43 +08:00
parent 377b892102
commit ad3a7fde32
3 changed files with 38 additions and 0 deletions

View File

@ -421,6 +421,17 @@ func Test_write_val_int_ptr(t *testing.T) {
should.Equal("1001", buf.String())
}
func Test_json_number(t *testing.T) {
should := require.New(t)
var arr []json.Number
err := Unmarshal([]byte(`[1]`), &arr)
should.Nil(err)
should.Equal(json.Number("1"), arr[0])
str, err := MarshalToString(arr)
should.Nil(err)
should.Equal(`[1]`, str)
}
func Benchmark_jsoniter_encode_int(b *testing.B) {
stream := NewStream(ioutil.Discard, 64)
for n := 0; n < b.N; n++ {