MCPcopy Create free account
hub / github.com/dop251/goja / TestGoMapReflectWithMethods

Function TestGoMapReflectWithMethods

object_gomap_reflect_test.go:153–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

151}
152
153func TestGoMapReflectWithMethods(t *testing.T) {
154 const SCRIPT = `
155 typeof m === "object" && !m.hasOwnProperty("t") && m.hasOwnProperty("Method") && m.Method();
156 `
157
158 vm := New()
159 m := make(gomapReflect_withMethods)
160 m["t"] = 42
161 vm.Set("m", m)
162 v, err := vm.RunString(SCRIPT)
163 if err != nil {
164 t.Fatal(err)
165 }
166 if !v.StrictEquals(valueTrue) {
167 t.Fatalf("Expected true, got %v", v)
168 }
169
170}
171
172func TestGoMapReflectWithProto(t *testing.T) {
173 vm := New()

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
RunStringMethod · 0.80
SetMethod · 0.65
StrictEqualsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…