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

Function TestMap_Delete

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

Source from the content-addressed store, hash-verified

40}
41
42func TestMap_Delete(t *testing.T) {
43 t.Parallel()
44 m := NewMap[string, int]()
45 m.Store("a", 1)
46 m.Store("b", 2)
47
48 m.Delete("a")
49 _, ok := m.Load("a")
50 assert.False(t, ok)
51 assert.Equal(t, 1, m.Length())
52
53 // Deleting a missing key is a no-op.
54 m.Delete("missing")
55 assert.Equal(t, 1, m.Length())
56}
57
58func TestMap_Length(t *testing.T) {
59 t.Parallel()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected