Skip to content

Commit

Permalink
Add cache tests
Browse files Browse the repository at this point in the history
  • Loading branch information
s12v committed Jul 30, 2018
1 parent 856e5f0 commit aebe6a7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,20 @@ func TestDefaultCache_GetWithExpiration_Expired(t *testing.T) {
t.Fatalf("val should be nil, got %v instead", val)
}
}

func TestDefaultCache(t *testing.T) {
DefaultCache(time.Hour)
DefaultCache(0)
DefaultCache(-1)
}

func TestDefaultCache_InvalidTtl(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("expected a panic")
}
}()
DefaultCache(-2)
}


0 comments on commit aebe6a7

Please sign in to comment.