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

Function TestGoMapReflectIntKey

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

Source from the content-addressed store, hash-verified

29}
30
31func TestGoMapReflectIntKey(t *testing.T) {
32 const SCRIPT = `
33 m[2] = m[0] + m[1];
34 `
35
36 vm := New()
37 m := map[int]int{
38 0: 40,
39 1: 2,
40 }
41 vm.Set("m", m)
42
43 _, err := vm.RunString(SCRIPT)
44 if err != nil {
45 t.Fatal(err)
46 }
47
48 if c := m[2]; c != 42 {
49 t.Fatalf("Unexpected value: '%d'", c)
50 }
51}
52
53func TestGoMapReflectDelete(t *testing.T) {
54 const SCRIPT = `

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
RunStringMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…