1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

consolidate more tests

This commit is contained in:
Tao Wen
2018-02-14 08:58:59 +08:00
parent 658ff9ef15
commit a8708bca85
6 changed files with 54 additions and 108 deletions

View File

@ -1,8 +1,14 @@
package test
import "math/big"
import (
"math/big"
"encoding/json"
)
func init() {
var pRawMessage = func(val json.RawMessage) *json.RawMessage {
return &val
}
nilMap := map[string]string(nil)
marshalCases = append(marshalCases,
map[string]interface{}{"abc": 1},
@ -20,6 +26,7 @@ func init() {
},
nilMap,
&nilMap,
map[string]*json.RawMessage{"hello":pRawMessage(json.RawMessage("[]"))},
)
unmarshalCases = append(unmarshalCases, unmarshalCase{
ptr: (*map[string]string)(nil),
@ -27,6 +34,9 @@ func init() {
}, unmarshalCase{
ptr: (*map[string]string)(nil),
input: `null`,
}, unmarshalCase{
ptr: (*map[string]*json.RawMessage)(nil),
input: "{\"test\":[{\"key\":\"value\"}]}",
})
}