MCPcopy
hub / github.com/gopherjs/gopherjs / Test_MapEmbeddedObject

Function Test_MapEmbeddedObject

tests/map_js_test.go:98–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func 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}

Callers

nothing calls this directly

Calls 2

GetMethod · 0.65
CallMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…