Skip to content

Commit

Permalink
Add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmlkzdh committed Oct 21, 2024
1 parent 220dea0 commit 19e978d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions timedmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ func TestTimedMapExpiration(t *testing.T) {
}
}

func TestTimedMapOverride(t *testing.T) {
tm := New[string, int](time.Minute)
tm.Put("key1", 19, 100*time.Millisecond)
time.Sleep(50 * time.Millisecond)
tm.Put("key1", 23, 200*time.Millisecond)
time.Sleep(100 * time.Millisecond)
_, ok := tm.Get("key1")
if !ok {
t.Errorf("expected key1 to still be present")
}
}

func TestTimedMapCleanup(t *testing.T) {
tm := New[string, int](200 * time.Millisecond)
tm.Put("key", 19, 100*time.Millisecond)
Expand Down

0 comments on commit 19e978d

Please sign in to comment.