summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2023-04-13 12:05:41 -0400
committerGitHub <noreply@github.com>2023-04-13 19:05:41 +0300
commitbc82309ceb0cc4cbdf74faac6816b49b981199be (patch)
tree68e0eb09db443b6b68f89537f061ec21daaa2599 /tests
parent1250c3cf805687a3be275f09d387cc1c2bb08d05 (diff)
downloadredis-bc82309ceb0cc4cbdf74faac6816b49b981199be.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/type/list.tcl9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit/type/list.tcl b/tests/unit/type/list.tcl
index d970b0278..1e1ba4edc 100644
--- a/tests/unit/type/list.tcl
+++ b/tests/unit/type/list.tcl
@@ -1416,6 +1416,15 @@ foreach {pop} {BLPOP BLMPOP_LEFT} {
set e
} {*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 {num} {250 500} {
if {$type == "quicklist"} {