1
0
mirror of https://github.com/json-iterator/go.git synced 2025-04-20 11:28:49 +02:00
json-iterator/any_tests/jsoniter_any_null_test.go

17 lines
355 B
Go
Raw Normal View History

2018-02-13 20:58:29 +08:00
package any_tests
2017-06-17 21:32:48 +08:00
import (
2018-02-24 22:04:41 +08:00
"github.com/json-iterator/go"
"github.com/stretchr/testify/require"
2017-06-19 23:43:53 +08:00
"testing"
2017-06-17 21:32:48 +08:00
)
func Test_read_null_as_any(t *testing.T) {
should := require.New(t)
2018-02-13 20:58:29 +08:00
any := jsoniter.Get([]byte(`null`))
2017-06-17 21:32:48 +08:00
should.Equal(0, any.ToInt())
should.Equal(float64(0), any.ToFloat64())
should.Equal("", any.ToString())
should.False(any.ToBool())
}