(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestExpireStructure_PTTL(t *testing.T) { |
| 122 | expire, _ := initExpire() |
| 123 | defer expire.db.Close() |
| 124 | |
| 125 | key := "test_key" |
| 126 | milliseconds := int64(2000) |
| 127 | |
| 128 | // Test PTTL function with an existing key |
| 129 | expire.PEXPIRE(key, milliseconds) |
| 130 | ttl, err := expire.PTTL(key) |
| 131 | assert.Nil(t, err) |
| 132 | assert.True(t, ttl > 0) // TTL should be positive |
| 133 | |
| 134 | // Test PTTL function with a non-existing key |
| 135 | ttl, err = expire.PTTL("non_existing_key") |
| 136 | assert.Nil(t, err) |
| 137 | assert.Equal(t, int64(-2), ttl) // -2 indicates that the key does not exist |
| 138 | } |
| 139 | |
| 140 | func TestExpireStructure_PERSIST(t *testing.T) { |
| 141 | expire, _ := initExpire() |
nothing calls this directly
no test coverage detected