1
0
mirror of https://github.com/json-iterator/go.git synced 2025-11-26 22:40:13 +02:00

#68 number to string

This commit is contained in:
Tao Wen
2017-06-20 15:11:01 +08:00
parent 8f6a840c63
commit 818ae1331a
19 changed files with 387 additions and 325 deletions

View File

@@ -56,7 +56,7 @@ func Test_two_field(t *testing.T) {
case "field2":
iter.ReadInt64()
default:
iter.reportError("bind object", "unexpected field")
iter.ReportError("bind object", "unexpected field")
}
}
}
@@ -206,6 +206,16 @@ func Test_decode_struct_field_with_tag(t *testing.T) {
should.Equal(100, obj.Field3)
}
func Test_decode_struct_field_with_tag_string(t *testing.T) {
should := require.New(t)
type TestObject struct {
Field1 int `json:",string"`
}
obj := TestObject{Field1: 100}
should.Nil(UnmarshalFromString(`{"Field1": "100"}`, &obj))
should.Equal(100, obj.Field1)
}
func Test_write_val_zero_field_struct(t *testing.T) {
should := require.New(t)
type TestObject struct {