1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

support naming strategy

This commit is contained in:
Tao Wen
2017-06-20 23:09:53 +08:00
parent 83fa27ff9a
commit 29a928e1d2
4 changed files with 74 additions and 4 deletions

View File

@ -60,3 +60,11 @@ func Test_use_number(t *testing.T) {
should.Nil(decoder2.Decode(&obj2))
should.Equal(json.Number("123"), obj2)
}
func Test_use_number_for_unmarshal(t *testing.T) {
should := require.New(t)
api := Config{UseNumber: true}.Froze()
var obj interface{}
should.Nil(api.UnmarshalFromString("123", &obj))
should.Equal(json.Number("123"), obj)
}