mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 16:57:06 +08:00
Feat: Add HStrlen Command.
This commit is contained in:
@@ -26,7 +26,7 @@ func TestHSet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// test hget and hexists
|
||||
// test hget, hexists and hstrlen
|
||||
for field, v := range values {
|
||||
actual := testDB.Exec(nil, utils.ToCmdLine("hget", key, field))
|
||||
expected := protocol.MakeBulkReply(v)
|
||||
@@ -37,6 +37,11 @@ func TestHSet(t *testing.T) {
|
||||
if intResult, _ := actual.(*protocol.IntReply); intResult.Code != int64(1) {
|
||||
t.Error(fmt.Sprintf("expected %d, actually %d", 1, intResult.Code))
|
||||
}
|
||||
|
||||
actual = testDB.Exec(nil, utils.ToCmdLine("hstrlen", key, field))
|
||||
if intResult, _ := actual.(*protocol.IntReply); intResult.Code != int64(len(v)) {
|
||||
t.Error(fmt.Sprintf("expected %d, actually %d", int64(len(v)), intResult.Code))
|
||||
}
|
||||
}
|
||||
|
||||
// test hlen
|
||||
|
Reference in New Issue
Block a user