Unverified Commit bc82309c authored by Wen Hui's avatar Wen Hui Committed by GitHub
Browse files

Adding missing test cases for linsert command (#12040)

Currently LINSERT command does not have the test case coverage for following scenarios.
1. When key does not exist, it is considered an empty list and no operation is performed.
2. An error is returned when key exists but does not hold a list value.

Added above two missing test cases for linsert command.
parent 1250c3cf
...@@ -1416,6 +1416,15 @@ foreach {pop} {BLPOP BLMPOP_LEFT} { ...@@ -1416,6 +1416,15 @@ foreach {pop} {BLPOP BLMPOP_LEFT} {
set e set e
} {*ERR*syntax*error*} } {*ERR*syntax*error*}
test {LINSERT against non-list value error} {
r set k1 v1
assert_error {WRONGTYPE Operation against a key holding the wrong kind of value*} {r linsert k1 after 0 0}
}
test {LINSERT against non existing key} {
assert_equal 0 [r linsert not-a-key before 0 0]
}
foreach type {listpack quicklist} { foreach type {listpack quicklist} {
foreach {num} {250 500} { foreach {num} {250 500} {
if {$type == "quicklist"} { if {$type == "quicklist"} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment