mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
RPOPLPUSH tests added
This commit is contained in:
parent
91d71bfc79
commit
c08f173487
2
TODO
2
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".
|
||||
* Man pages for MSET MSETNX and SRANDMEMBER, Z-commands, ...
|
||||
* 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.
|
||||
* 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.
|
||||
|
@ -20,7 +20,7 @@ array set ::redis::multibulkarg {}
|
||||
|
||||
# Flag commands requiring last argument as a bulk write operation
|
||||
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) {}
|
||||
}
|
||||
|
@ -257,6 +257,45 @@ proc main {server port} {
|
||||
format $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} {
|
||||
$r set mykey hello
|
||||
$r rename mykey mykey1
|
||||
|
Loading…
x
Reference in New Issue
Block a user