MCPcopy
hub / github.com/mochi-mqtt/server / TestHooksAddLenGetAll

Function TestHooksAddLenGetAll

hooks_test.go:193–207  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

191}
192
193func TestHooksAddLenGetAll(t *testing.T) {
194 h := new(Hooks)
195 err := h.Add(new(HookBase), nil)
196 require.NoError(t, err)
197
198 err = h.Add(new(modifiedHookBase), nil)
199 require.NoError(t, err)
200
201 require.Equal(t, int64(2), atomic.LoadInt64(&h.qty))
202 require.Equal(t, int64(2), h.Len())
203
204 all := h.GetAll()
205 require.Equal(t, "base", all[0].ID())
206 require.Equal(t, "modified", all[1].ID())
207}
208
209func TestHooksAddInitFailure(t *testing.T) {
210 h := new(Hooks)

Callers

nothing calls this directly

Calls 4

IDMethod · 0.65
AddMethod · 0.45
LenMethod · 0.45
GetAllMethod · 0.45

Tested by

no test coverage detected