(t *testing.T)
| 96 | } |
| 97 | |
| 98 | func Test_MapEmbeddedObject(t *testing.T) { |
| 99 | o := js.Global.Get("JSON").Call("parse", `{"props": {"one": 1, "two": 2}}`) |
| 100 | |
| 101 | type data struct { |
| 102 | *js.Object |
| 103 | Props map[string]int `js:"props"` |
| 104 | } |
| 105 | |
| 106 | d := data{Object: o} |
| 107 | if d.Props["one"] != 1 { |
| 108 | t.Errorf("key 'one' value Got: %d, Want: %d", d.Props["one"], 1) |
| 109 | } |
| 110 | if d.Props["two"] != 2 { |
| 111 | t.Errorf("key 'two' value Got: %d, Want: %d", d.Props["two"], 2) |
| 112 | } |
| 113 | } |