MCPcopy Index your code
hub / github.com/docker/docker-agent / TestMap_StoreLoad

Function TestMap_StoreLoad

pkg/concurrent/map_test.go:11–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestMap_StoreLoad(t *testing.T) {
12 t.Parallel()
13 m := NewMap[string, int]()
14
15 m.Store("a", 1)
16 m.Store("b", 2)
17
18 val, ok := m.Load("a")
19 assert.True(t, ok)
20 assert.Equal(t, 1, val)
21
22 val, ok = m.Load("b")
23 assert.True(t, ok)
24 assert.Equal(t, 2, val)
25
26 _, ok = m.Load("missing")
27 assert.False(t, ok)
28}
29
30func TestMap_StoreOverwrites(t *testing.T) {
31 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewMapFunction · 0.85
LoadMethod · 0.80
StoreMethod · 0.45

Tested by

no test coverage detected