Skip to content

Commit

Permalink
Add missing test cases for hash commands (redis#12851)
Browse files Browse the repository at this point in the history
We dont have test for hgetall against key doesnot exist so added the
test in test suite and along with this, added wrong type cases for other
missing commands.
  • Loading branch information
hwware authored Dec 17, 2023
1 parent adbb534 commit 5dc631d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/unit/type/hash.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ start_server {tags {"hash"}} {
assert_error "WRONGTYPE Operation against a key*" {r hvals wrongtype}
assert_error "WRONGTYPE Operation against a key*" {r hkeys wrongtype}
assert_error "WRONGTYPE Operation against a key*" {r hexists wrongtype field1}
assert_error "WRONGTYPE Operation against a key*" {r hset wrongtype field1 val1}
assert_error "WRONGTYPE Operation against a key*" {r hmset wrongtype field1 val1 field2 val2}
assert_error "WRONGTYPE Operation against a key*" {r hsetnx wrongtype field1 val1}
assert_error "WRONGTYPE Operation against a key*" {r hlen wrongtype}
assert_error "WRONGTYPE Operation against a key*" {r hscan wrongtype 0}
}

test {HMGET - small hash} {
Expand Down Expand Up @@ -429,6 +434,11 @@ start_server {tags {"hash"}} {
lsort [r hgetall bighash]
} [lsort [array get bighash]]

test {HGETALL against non-existing key} {
r del htest
r hgetall htest
} {}

test {HDEL and return value} {
set rv {}
lappend rv [r hdel smallhash nokey]
Expand Down

0 comments on commit 5dc631d

Please sign in to comment.