| 1414 | } |
| 1415 | |
| 1416 | func 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 | |
| 1428 | func BenchmarkCacheGetExpiring(b *testing.B) { |
| 1429 | benchmarkCacheGet(b, 5*time.Minute) |