@@ -286,27 +286,6 @@ func Test_marshal_json_with_time(t *testing.T) {
286
286
should .NotNil (obj .TF1 .F2 )
287
287
}
288
288
289
- func Test_unmarshal_empty_interface_as_int64 (t * testing.T ) {
290
- var obj interface {}
291
- RegisterTypeDecoderFunc ("interface {}" , func (ptr unsafe.Pointer , iter * Iterator ) {
292
- switch iter .WhatIsNext () {
293
- case NumberValue :
294
- * (* interface {})(ptr ) = iter .ReadInt64 ()
295
- default :
296
- * (* interface {})(ptr ) = iter .Read ()
297
- }
298
- })
299
- should := require .New (t )
300
- Unmarshal ([]byte ("100" ), & obj )
301
- should .Equal (int64 (100 ), obj )
302
- Unmarshal ([]byte (`"hello"` ), & obj )
303
- should .Equal ("hello" , obj )
304
- var arr []interface {}
305
- Unmarshal ([]byte ("[100]" ), & arr )
306
- should .Equal (int64 (100 ), arr [0 ])
307
- }
308
-
309
-
310
289
func Test_customize_tag_key (t * testing.T ) {
311
290
312
291
type TestObject struct {
@@ -318,4 +297,20 @@ func Test_customize_tag_key(t *testing.T) {
318
297
str , err := json .MarshalToString (TestObject {"hello" })
319
298
should .Nil (err )
320
299
should .Equal (`{"field":"hello"}` , str )
300
+ }
301
+
302
+ func Test_recursive_empty_interface_customization (t * testing.T ) {
303
+ t .Skip ()
304
+ var obj interface {}
305
+ RegisterTypeDecoderFunc ("interface {}" , func (ptr unsafe.Pointer , iter * Iterator ) {
306
+ switch iter .WhatIsNext () {
307
+ case NumberValue :
308
+ * (* interface {})(ptr ) = iter .ReadInt64 ()
309
+ default :
310
+ * (* interface {})(ptr ) = iter .Read ()
311
+ }
312
+ })
313
+ should := require .New (t )
314
+ Unmarshal ([]byte ("[100]" ), & obj )
315
+ should .Equal ([]interface {}{int64 (100 )}, obj )
321
316
}
0 commit comments