(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestExpireStructure_EXPIREAT(t *testing.T) { |
| 63 | expire, _ := initExpire() |
| 64 | defer expire.db.Close() |
| 65 | |
| 66 | key := "test_key" |
| 67 | timestamp := time.Now().Add(time.Second * 2).Unix() |
| 68 | |
| 69 | // Test EXPIREAT function |
| 70 | expireErr = expire.EXPIREAT(key, timestamp) |
| 71 | assert.Nil(t, expireErr) |
| 72 | |
| 73 | // Wait for the key to expire |
| 74 | time.Sleep(time.Second * 3) |
| 75 | |
| 76 | // Check if the key has expired |
| 77 | ttl, err := expire.TTL(key) |
| 78 | assert.Nil(t, err) |
| 79 | assert.Equal(t, int64(-2), ttl) // -2 indicates that the key does not exist |
| 80 | } |
| 81 | |
| 82 | func TestExpireStructure_PEXPIREAT(t *testing.T) { |
| 83 | expire, _ := initExpire() |
nothing calls this directly
no test coverage detected