Test: pkg modifications

This commit is contained in:
HFO4
2020-02-17 14:17:06 +08:00
parent 0502a0f212
commit 663b827a1d
3 changed files with 52 additions and 0 deletions

View File

@@ -135,3 +135,13 @@ func TestMemoStore_Delete(t *testing.T) {
asserts.Equal([]string{"1", "2"}, miss)
asserts.Equal(map[string]interface{}{"3": "3.val", "4": "4.val"}, values)
}
func TestMemoStore_GarbageCollect(t *testing.T) {
asserts := assert.New(t)
store := NewMemoStore()
store.Set("test", 1, 1)
time.Sleep(time.Duration(2000) * time.Millisecond)
store.GarbageCollect()
_, ok := store.Get("test")
asserts.False(ok)
}