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

Function TestSerializeUnserializable

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

Source from the content-addressed store, hash-verified

1414}
1415
1416func TestSerializeUnserializable(t *testing.T) {
1417 tc := New(DefaultExpiration, 0)
1418 ch := make(chan bool, 1)
1419 ch <- true
1420 tc.Set("chan", ch, DefaultExpiration)
1421 fp := &bytes.Buffer{}
1422 err := tc.Save(fp) // this should fail gracefully
1423 if err.Error() != "gob NewTypeObject can't handle type: chan bool" {
1424 t.Error("Error from Save was not gob NewTypeObject can't handle type chan bool:", err)
1425 }
1426}
1427
1428func BenchmarkCacheGetExpiring(b *testing.B) {
1429 benchmarkCacheGet(b, 5*time.Minute)

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
SaveMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…