go-common/library/cache/cache_test.go
2019-04-22 02:59:20 +00:00

21 lines
273 B
Go

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")
}
}