You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
273 B

package cache
import (
"testing"
"time"
)
func TestCache_Save(t *testing.T) {
ca := New(1, 1024)
var run bool
ca.Save(func() {
run = true
panic("error")
})
time.Sleep(time.Millisecond * 50)
t.Log("don't panic")
if !run {
t.Fatal("expect run be true")
}
}