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

Function TestMapCompareAndDelete

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

Source from the content-addressed store, hash-verified

122}
123
124func TestMapCompareAndDelete(t *testing.T) {
125 var m Map[int, string]
126 m.Store(1, "one")
127
128 ok := m.CompareAndDelete(1, "one")
129 if !ok {
130 t.Errorf("CompareAndDelete(1, 'one') = false; want true")
131 }
132
133 v, _ := m.Load(1)
134 if v != "" {
135 t.Errorf("Load(1) after CompareAndDelete = %v; want ''", v)
136 }
137}
138
139func TestMapSwap(t *testing.T) {
140 var m Map[int, string]

Callers

nothing calls this directly

Calls 4

StoreMethod · 0.80
CompareAndDeleteMethod · 0.80
ErrorfMethod · 0.80
LoadMethod · 0.80

Tested by

no test coverage detected