MCPcopy Index your code
hub / github.com/gopherjs/gopherjs / TestStructKey

Function TestStructKey

tests/misc_test.go:69–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestStructKey(t *testing.T) {
70 m := make(map[SingleValue]int)
71 m[SingleValue{Value: 1}] = 42
72 m[SingleValue{Value: 2}] = 43
73 if m[SingleValue{Value: 1}] != 42 || m[SingleValue{Value: 2}] != 43 || reflect.ValueOf(m).MapIndex(reflect.ValueOf(SingleValue{Value: 1})).Interface() != 42 {
74 t.Fail()
75 }
76
77 m2 := make(map[any]int)
78 m2[SingleValue{Value: 1}] = 42
79 m2[SingleValue{Value: 2}] = 43
80 m2[OtherSingleValue{Value: 1}] = 44
81 if m2[SingleValue{Value: 1}] != 42 || m2[SingleValue{Value: 2}] != 43 || m2[OtherSingleValue{Value: 1}] != 44 || reflect.ValueOf(m2).MapIndex(reflect.ValueOf(SingleValue{Value: 1})).Interface() != 42 {
82 t.Fail()
83 }
84}
85
86func TestSelectOnNilChan(t *testing.T) {
87 var c1 chan bool

Callers

nothing calls this directly

Calls 1

InterfaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…