MCPcopy Create free account
hub / github.com/patrickmn/go-cache / TestReplace

Function TestReplace

cache_test.go:1127–1138  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1125}
1126
1127func TestReplace(t *testing.T) {
1128 tc := New(DefaultExpiration, 0)
1129 err := tc.Replace("foo", "bar", DefaultExpiration)
1130 if err == nil {
1131 t.Error("Replaced foo when it shouldn't exist")
1132 }
1133 tc.Set("foo", "bar", DefaultExpiration)
1134 err = tc.Replace("foo", "bar", DefaultExpiration)
1135 if err != nil {
1136 t.Error("Couldn't replace existing key foo")
1137 }
1138}
1139
1140func TestDelete(t *testing.T) {
1141 tc := New(DefaultExpiration, 0)

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
ReplaceMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…