APPEND tests

This commit is contained in:
antirez 2010-02-04 16:38:33 +01:00
parent 4b00bebd3d
commit 3c290b9b52
2 changed files with 24 additions and 1 deletions

View File

@ -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 zincrby
set setnx rpush lpush lset lrem sadd srem sismember echo getset smove zadd zrem zscore zincrby append
} {
set ::redis::bulkarg($redis_bulk_cmd) {}
}

View File

@ -1600,6 +1600,29 @@ proc main {server port} {
list $v1 $v2 $v3
} {QUEUED QUEUED {{a b c} PONG}}
test {APPEND basics} {
list [$r append foo bar] [$r get foo] \
[$r append foo 100] [$r get foo]
} {3 bar 6 bar100}
test {APPEND fuzzing} {
set err {}
foreach type {binary alpha compr} {
set buf {}
$r del x
for {set i 0} {$i < 1000} {incr i} {
set bin [randstring 0 10 $type]
append buf $bin
$r append x $bin
}
if {$buf != [$r get x]} {
set err "Expected '$buf' found '[$r get x]'"
break
}
}
set _ $err
} {}
# Leave the user with a clean DB before to exit
test {FLUSHDB} {
set aux {}