11package confl
22
33import (
4- "encoding/json"
54 "fmt"
65 "log"
76 "reflect"
@@ -454,8 +453,9 @@ func TestDecodeMap(t *testing.T) {
454453 }
455454 var tab table
456455 tab .H = map [string ]interface {}{
457- `table` : & Table2 {Name : `0` },
458- `list` : []string {`1` , `2` },
456+ `table` : & Table2 {Name : `0` },
457+ `table2` : Table2 {Name : `00` },
458+ `list` : []string {`1` , `2` },
459459 `mapInMap` : map [string ]interface {}{
460460 `inString` : `v` ,
461461 `inList` : []string {`1` , `2` },
@@ -465,6 +465,9 @@ func TestDecodeMap(t *testing.T) {
465465 table : {
466466 Name : "1"
467467 }
468+ table2 : {
469+ Name : "10"
470+ }
468471 list : ["11","12"]
469472 mapInMap : {
470473 "inString" : "y"
@@ -474,19 +477,18 @@ func TestDecodeMap(t *testing.T) {
474477 if _ , err := Decode (str , & tab ); err != nil {
475478 t .Fatal (err )
476479 }
477- expected , _ := json . Marshal ( table {
480+ expected := table {
478481 H : map [string ]interface {}{
479- `table` : & Table2 {Name : `1` },
480- `list` : []string {`11` , `12` },
482+ `table` : & Table2 {Name : `1` },
483+ `table2` : Table2 {Name : `10` },
484+ `list` : []string {`11` , `12` },
481485 `mapInMap` : map [string ]interface {}{
482486 `inString` : `y` ,
483487 `inList` : []string {`21` , `22` },
484488 },
485489 },
486- })
487- actual , _ := json .Marshal (tab )
488- println (string (actual ))
489- assert .Equal (t , string (expected ), string (actual ))
490+ }
491+ assert .Equal (t , expected , tab )
490492}
491493
492494func TestDecodeSizedInts (t * testing.T ) {
0 commit comments