MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestOn

Function TestOn

internal/events/utils_test.go:8–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestOn(t *testing.T) {
9 type User struct {
10 name string
11 }
12 var u = &User{name: "lily"}
13 var u2 = &User{name: "lucy"}
14
15 events.On("hello", func() {
16 t.Log("world")
17 })
18 events.On("hello", func() {
19 t.Log("world2")
20 })
21 events.OnKey("hello", u, func() {
22 t.Log("world3")
23 })
24 events.OnKey("hello", u, func() {
25 t.Log("world4")
26 })
27 events.Remove(u)
28 events.Remove(u2)
29 events.OnKey("hello2", nil, func() {
30 t.Log("world2")
31 })
32 events.Notify("hello")
33}

Callers

nothing calls this directly

Calls 5

OnFunction · 0.92
OnKeyFunction · 0.92
RemoveFunction · 0.92
NotifyFunction · 0.92
LogMethod · 0.80

Tested by

no test coverage detected