2
0

Note about channels being unserializable

This commit is contained in:
Patrick Mylund Nielsen
2012-01-29 04:04:33 +01:00
parent 106d5795c8
commit d5cd41da53
2 changed files with 15 additions and 1 deletions
+12
View File
@@ -551,6 +551,18 @@ func testFillAndSerialize(t *testing.T, tc *Cache) {
}
}
func TestSerializeUnserializable(t *testing.T) {
tc := New(0, 0)
ch := make(chan bool, 1)
ch <- true
tc.Set("chan", ch, 0)
fp := &bytes.Buffer{}
err := tc.Save(fp) // this should fail gracefully
if err.Error() != "gob NewTypeObject can't handle type: chan bool" {
t.Error("Error from Save was not gob NewTypeObject can't handle type chan bool:", err)
}
}
func BenchmarkCacheGet(b *testing.B) {
tc := New(0, 0)
tc.Set("foo", "bar", 0)