| 1430 | } |
| 1431 | |
| 1432 | func TestSerializeUnserializable(t *testing.T) { |
| 1433 | tc := New(DefaultExpiration, 0) |
| 1434 | ch := make(chan bool, 1) |
| 1435 | ch <- true |
| 1436 | tc.Set("chan", ch, DefaultExpiration) |
| 1437 | fp := &bytes.Buffer{} |
| 1438 | err := tc.Save(fp) // this should fail gracefully |
| 1439 | if err.Error() != "gob NewTypeObject can't handle type: chan bool" { |
| 1440 | t.Error("Error from Save was not gob NewTypeObject can't handle type chan bool:", err) |
| 1441 | } |
| 1442 | } |
| 1443 | |
| 1444 | func BenchmarkCacheGetExpiring(b *testing.B) { |
| 1445 | benchmarkCacheGet(b, 5*time.Minute) |