MCPcopy Create free account
hub / github.com/cloud-native-go/examples / TestDelete

Function TestDelete

ch08/hexarch/core/core_test.go:89–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestDelete(t *testing.T) {
90 store := NewKeyValueStore()
91
92 const key = "delete-key"
93 const value = "delete-value"
94
95 var contains bool
96
97 defer delete(store.m, key)
98
99 store.m[key] = value
100
101 _, contains = store.m[key]
102 if !contains {
103 t.Error("key/value doesn't exist")
104 }
105
106 store.Delete(key)
107
108 _, contains = store.m[key]
109 if contains {
110 t.Error("Delete failed")
111 }
112}

Callers

nothing calls this directly

Calls 2

DeleteMethod · 0.95
NewKeyValueStoreFunction · 0.85

Tested by

no test coverage detected