提交 c08f1734 编写于 作者: A antirez

RPOPLPUSH tests added

上级 91d71bfc
...@@ -3,7 +3,7 @@ VERSION 1.1 TODO ...@@ -3,7 +3,7 @@ VERSION 1.1 TODO
* For now only the last argument gets integer encoded, so make sure that: 1) every multi bulk commands implemented will have the last arg that is indeed a value, and not used otherwise. 2) to explicitly call the function to encode the object in MSET and other commands where there are multiple "values". * For now only the last argument gets integer encoded, so make sure that: 1) every multi bulk commands implemented will have the last arg that is indeed a value, and not used otherwise. 2) to explicitly call the function to encode the object in MSET and other commands where there are multiple "values".
* Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ... * Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ...
* Use strcoll() to compare objects in sorted sets, like it already happens for SORT. * Use strcoll() to compare objects in sorted sets, like it already happens for SORT.
* LPOPPUSH, EXPIRE, EXPIREAT, ZSCORE, SRANDMEMBER tests. * RPOPLPUSH, EXPIRE, EXPIREAT, ZSCORE, SRANDMEMBER tests.
* Write docs for the "STORE" operaiton of SORT, and GET "#" option. * Write docs for the "STORE" operaiton of SORT, and GET "#" option.
* Append only mode: testing and a command to rebuild the log from scratch. * Append only mode: testing and a command to rebuild the log from scratch.
* Redis-cli should be able to select a different DB than 0 using some switch. * Redis-cli should be able to select a different DB than 0 using some switch.
......
...@@ -20,7 +20,7 @@ array set ::redis::multibulkarg {} ...@@ -20,7 +20,7 @@ array set ::redis::multibulkarg {}
# Flag commands requiring last argument as a bulk write operation # Flag commands requiring last argument as a bulk write operation
foreach redis_bulk_cmd { foreach redis_bulk_cmd {
set setnx rpush lpush lset lrem sadd srem sismember echo getset smove zadd zrem zscore set setnx rpush lpush lset lrem sadd srem sismember echo getset smove zadd zrem zscore rpoplpush
} { } {
set ::redis::bulkarg($redis_bulk_cmd) {} set ::redis::bulkarg($redis_bulk_cmd) {}
} }
......
...@@ -257,6 +257,45 @@ proc main {server port} { ...@@ -257,6 +257,45 @@ proc main {server port} {
format $err format $err
} {ERR*} } {ERR*}
test {RPOPLPUSH base case} {
$r del mylist
$r rpush mylist a
$r rpush mylist b
$r rpush mylist c
$r rpush mylist d
set v1 [$r rpoplpush mylist newlist]
set v2 [$r rpoplpush mylist newlist]
set l1 [$r lrange mylist 0 -1]
set l2 [$r lrange newlist 0 -1]
list $v1 $v2 $l1 $l2
} {d c {a b} {c d}}
test {RPOPLPUSH with the same list as src and dst} {
$r del mylist
$r rpush mylist a
$r rpush mylist b
$r rpush mylist c
set l1 [$r lrange mylist 0 -1]
set v [$r rpoplpush mylist mylist]
set l2 [$r lrange mylist 0 -1]
list $l1 $v $l2
} {{a b c} c {c a b}}
test {RPOPLPUSH target list already exists} {
$r del mylist
$r del newlist
$r rpush mylist a
$r rpush mylist b
$r rpush mylist c
$r rpush mylist d
$r rpush newlist x
set v1 [$r rpoplpush mylist newlist]
set v2 [$r rpoplpush mylist newlist]
set l1 [$r lrange mylist 0 -1]
set l2 [$r lrange newlist 0 -1]
list $v1 $v2 $l1 $l2
} {d c {a b} {c d x}}
test {RENAME basic usage} { test {RENAME basic usage} {
$r set mykey hello $r set mykey hello
$r rename mykey mykey1 $r rename mykey mykey1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册