From 6839f0fc0fd05eeada49fac490e6ed88023d01a2 Mon Sep 17 00:00:00 2001 From: MrMelon54 Date: Thu, 6 Feb 2025 21:46:52 +0000 Subject: [PATCH] Use timeNow variable for time.Now for use with testing --- cache_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cache_test.go b/cache_test.go index d0ea62b..7c94f0e 100644 --- a/cache_test.go +++ b/cache_test.go @@ -110,7 +110,7 @@ func TestCache_Range(t *testing.T) { } func TestCache_Cleaner(t *testing.T) { - timeNow = func() time.Time { return time.Now() } + timeNow = time.Now n := time.Now().Add(2 * time.Second) c := New[string, string]() @@ -134,7 +134,7 @@ func TestCache_Cleaner(t *testing.T) { } func TestCache_UpdateExpiry(t *testing.T) { - timeNow = func() time.Time { return time.Now() } + timeNow = time.Now c := New[string, string]() c.Set("a", "b", time.Now().Add(2*time.Second)) @@ -154,7 +154,7 @@ func TestCache_UpdateExpiry(t *testing.T) { } func TestCache_ClearerDeath(t *testing.T) { - timeNow = func() time.Time { return time.Now() } + timeNow = time.Now c := New[string, string]()