summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-04-15 16:52:07 +0200
committerantirez <antirez@gmail.com>2011-04-15 17:15:59 +0200
commit1b905277bb61255441a24a2a3667d5899b1c448f (patch)
tree91d0c5034181090cfb4dbb8b33a77d20776ddcfa
parentfb90934c476ee0ece9b1dc0d9e05c766c96c0b3f (diff)
downloadredis-1b905277bb61255441a24a2a3667d5899b1c448f.tar.gz
tests for variadic list push
-rw-r--r--tests/unit/type/list.tcl16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/type/list.tcl b/tests/unit/type/list.tcl
index 6b128b726..b6055b266 100644
--- a/tests/unit/type/list.tcl
+++ b/tests/unit/type/list.tcl
@@ -55,6 +55,13 @@ start_server {
assert_equal $largevalue(linkedlist) [r lindex mylist2 2]
}
+ test {Variadic RPUSH/LPUSH} {
+ r del mylist
+ assert_equal 4 [r lpush mylist a b c d]
+ assert_equal 8 [r rpush mylist 0 1 2 3]
+ assert_equal {d c b a 0 1 2 3} [r lrange mylist 0 -1]
+ }
+
test {DEL a list - ziplist} {
assert_equal 1 [r del myziplist2]
assert_equal 0 [r exists myziplist2]
@@ -142,6 +149,15 @@ start_server {
}
}
+ test "BLPOP with variadic LPUSH" {
+ set rd [redis_deferring_client]
+ r del blist target
+ $rd blpop blist 0
+ assert_equal 2 [r lpush blist foo bar]
+ assert_equal {blist foo} [$rd read]
+ assert_equal bar [lindex [r lrange blist 0 -1] 0]
+ }
+
test "BRPOPLPUSH with zero timeout should block indefinitely" {
set rd [redis_deferring_client]
r del blist target