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

Function TestMap_Clear

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

Source from the content-addressed store, hash-verified

198}
199
200func TestMap_Clear(t *testing.T) {
201 t.Parallel()
202 m := NewMap[string, int]()
203 m.Store("a", 1)
204 m.Store("b", 2)
205 m.Store("c", 3)
206
207 m.Clear()
208 assert.Equal(t, 0, m.Length())
209
210 _, ok := m.Load("a")
211 assert.False(t, ok)
212
213 // Map is usable after Clear.
214 m.Store("d", 4)
215 val, ok := m.Load("d")
216 assert.True(t, ok)
217 assert.Equal(t, 4, val)
218}
219
220func TestMap_ClearZeroValue(t *testing.T) {
221 t.Parallel()

Callers

nothing calls this directly

Calls 5

NewMapFunction · 0.85
LoadMethod · 0.80
ClearMethod · 0.65
StoreMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected