mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-06 17:26:52 +08:00
fix tiny bugs
This commit is contained in:
@@ -208,10 +208,18 @@ func TestExpiredTime(t *testing.T) {
|
|||||||
testDB.Exec(nil, utils.ToCmdLine("EXPIRE", key, "2"))
|
testDB.Exec(nil, utils.ToCmdLine("EXPIRE", key, "2"))
|
||||||
//tt := time.Now()
|
//tt := time.Now()
|
||||||
result = testDB.Exec(nil, utils.ToCmdLine("ttl", key))
|
result = testDB.Exec(nil, utils.ToCmdLine("ttl", key))
|
||||||
asserts.AssertIntReply(t, result, 2)
|
intResult, ok := result.(*protocol.IntReply)
|
||||||
|
if !ok {
|
||||||
|
t.Error(fmt.Sprintf("expected int protocol, actually %s", result.ToBytes()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if intResult.Code < 0 || intResult.Code > 2 {
|
||||||
|
t.Errorf("expected ttl more than 0, actual: %d", intResult.Code)
|
||||||
|
return
|
||||||
|
}
|
||||||
result = testDB.Exec(nil, utils.ToCmdLine("EXPIRETIME", key))
|
result = testDB.Exec(nil, utils.ToCmdLine("EXPIRETIME", key))
|
||||||
asserts.AssertIntReply(t, result, int(time.Now().Add(2*time.Second).Unix()))
|
asserts.AssertIntReply(t, result, int(time.Now().Add(2*time.Second).Unix()))
|
||||||
intResult, ok := result.(*protocol.IntReply)
|
intResult, ok = result.(*protocol.IntReply)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Error(fmt.Sprintf("expected int protocol, actually %s", result.ToBytes()))
|
t.Error(fmt.Sprintf("expected int protocol, actually %s", result.ToBytes()))
|
||||||
return
|
return
|
||||||
|
@@ -74,7 +74,7 @@ func (b *BitMap) ForEachBit(begin int64, end int64, cb Callback) {
|
|||||||
}
|
}
|
||||||
bitOffset++
|
bitOffset++
|
||||||
offset++
|
offset++
|
||||||
if offset >= end {
|
if offset >= end && end != 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user