1
0
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:
Tao Wen
2017-06-17 21:32:48 +08:00
parent 2503ef17eb
commit 8ab46965bd
20 changed files with 641 additions and 728 deletions

@@ -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")