File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,30 @@ func TestDeleteExpired(t *testing.T) {
143
143
t .Errorf ("want %d items but got %d" , want , got )
144
144
}
145
145
})
146
+
147
+ t .Run ("issue #64" , func (t * testing.T ) {
148
+ defer restore ()
149
+ c := New [string , int ]()
150
+ c .Set ("1" , 4 , WithExpiration (0 )) // These should not be expired
151
+ c .Set ("2" , 5 , WithExpiration (- 1 )) // These should not be expired
152
+ c .Set ("3" , 6 , WithExpiration (1 * time .Hour ))
153
+
154
+ want := true
155
+ _ , ok := c .Get ("1" )
156
+ if ok != want {
157
+ t .Errorf ("want %t but got %t" , want , ok )
158
+ }
159
+
160
+ _ , ok = c .Get ("2" )
161
+ if ok != want {
162
+ t .Errorf ("want %t but got %t" , want , ok )
163
+ }
164
+ _ , ok = c .Get ("3" )
165
+ if ok != want {
166
+ t .Errorf ("want %t but got %t" , want , ok )
167
+ }
168
+
169
+ })
146
170
}
147
171
148
172
func max (x , y int ) int {
You can’t perform that action at this time.
0 commit comments