MCPcopy
hub / github.com/nats-io/nats.go / TestMapLoad

Function TestMapLoad

internal/syncx/map_test.go:20–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestMapLoad(t *testing.T) {
21 var m Map[int, string]
22 m.Store(1, "one")
23
24 v, ok := m.Load(1)
25 if !ok || v != "one" {
26 t.Errorf("Load(1) = %v, %v; want 'one', true", v, ok)
27 }
28
29 v, ok = m.Load(2)
30 if ok || v != "" {
31 t.Errorf("Load(2) = %v, %v; want '', false", v, ok)
32 }
33}
34
35func TestMapStore(t *testing.T) {
36 var m Map[int, string]

Callers

nothing calls this directly

Calls 3

StoreMethod · 0.80
LoadMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected