You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-08-10 22:09:23 +02:00
extract out any tests
This commit is contained in:
feature_iter.gojsoniter_any_array_test.gojsoniter_any_bool_test.gojsoniter_any_float_test.gojsoniter_any_int_test.gojsoniter_any_map_test.gojsoniter_any_null_test.gojsoniter_any_object_test.gojsoniter_any_string_test.gojsoniter_array_test.gojsoniter_bool_test.gojsoniter_float_test.gojsoniter_int_test.gojsoniter_iterator_test.gojsoniter_map_test.gojsoniter_null_test.gojsoniter_object_test.gojsoniter_reflect_struct_test.gojsoniter_reflect_test.gojsoniter_string_test.go
@@ -66,26 +66,6 @@ func Test_read_string_as_interface(t *testing.T) {
|
||||
should.Equal("hello", iter.Read())
|
||||
}
|
||||
|
||||
func Test_read_string_as_any(t *testing.T) {
|
||||
should := require.New(t)
|
||||
any, err := UnmarshalAnyFromString(`"hello"`)
|
||||
should.Nil(err)
|
||||
should.Equal("hello", any.ToString())
|
||||
should.True(any.ToBool())
|
||||
any, err = UnmarshalAnyFromString(`" "`)
|
||||
should.False(any.ToBool())
|
||||
any, err = UnmarshalAnyFromString(`"false"`)
|
||||
should.False(any.ToBool())
|
||||
any, err = UnmarshalAnyFromString(`"123"`)
|
||||
should.Equal(123, any.ToInt())
|
||||
}
|
||||
|
||||
func Test_wrap_string(t *testing.T) {
|
||||
should := require.New(t)
|
||||
any := WrapString("123")
|
||||
should.Equal(123, any.ToInt())
|
||||
}
|
||||
|
||||
func Test_write_string(t *testing.T) {
|
||||
should := require.New(t)
|
||||
str, err := MarshalToString("hello")
|
||||
|
Reference in New Issue
Block a user