added unmarshal map test

This commit is contained in:
Josh Baker 2016-08-24 15:59:54 -07:00
parent f4c008206b
commit 050904424f
1 changed files with 19 additions and 0 deletions

View File

@ -733,6 +733,25 @@ var exampleJSON = `{
}
}`
func TestUnmarshalMap(t *testing.T) {
var m1 = Parse(exampleJSON).Value().(map[string]interface{})
var m2 map[string]interface{}
if err := json.Unmarshal([]byte(exampleJSON), &m2); err != nil {
t.Fatal(err)
}
b1, err := json.Marshal(m1)
if err != nil {
t.Fatal(err)
}
b2, err := json.Marshal(m2)
if err != nil {
t.Fatal(err)
}
if bytes.Compare(b1, b2) != 0 {
t.Fatal("b1 != b2")
}
}
type BenchStruct struct {
Widget struct {
Window struct {