# The following AUTH test should be enabled only when requirepass
# <PASSWORD> is set in redis.conf and redis-server was started with
- # redis.conf as the first argument.
+ # redis.conf as the first argument.
#test {AUTH with requirepass in redis.conf} {
# $r auth foobared
test {SUNION with two sets} {
lsort [$r sunion set1 set2]
} [lsort -uniq "[$r smembers set1] [$r smembers set2]"]
-
+
test {SINTERSTORE with two sets} {
$r sinterstore setres set1 set2
lsort [$r smembers setres]
}
lsort [array names myset]
} {a b c}
-
+
test {Create a random list and a random set} {
set tosort {}
array set seenrand {}
list [$r zremrangebyrank zset 1 3] [$r zrange zset 0 -1]
} {3 {a e}}
+ test {ZUNION against non-existing key doesn't set destination} {
+ $r del zseta
+ list [$r zunion dst_key 1 zseta] [$r exists dst_key]
+ } {0 0}
+
test {ZUNION basics} {
$r del zseta zsetb zsetc
$r zadd zseta 1 a
set _ $err
} {}
+ test {HGET against non existing key} {
+ set rv {}
+ lappend rv [$r hget smallhash __123123123__]
+ lappend rv [$r hget bighash __123123123__]
+ set _ $rv
+ } {{} {}}
+
test {HSET in update and insert mode} {
set rv {}
set k [lindex [array names smallhash *] 0]
set _ $rv
} {0 newval1 1 0 newval2 1 1 1}
- test {HGET against non existing key} {
- set rv {}
- lappend rv [$r hget smallhash __123123123__]
- lappend rv [$r hget bighash __123123123__]
- set _ $rv
- } {{} {}}
+ test {HMSET wrong number of args} {
+ catch {$r hmset smallhash key1 val1 key2} err
+ format $err
+ } {*wrong number*}
+
+ test {HMSET - small hash} {
+ set args {}
+ foreach {k v} [array get smallhash] {
+ set newval [randstring 0 8 alpha]
+ set smallhash($k) $newval
+ lappend args $k $newval
+ }
+ $r hmset smallhash {*}$args
+ } {OK}
+
+ test {HMSET - big hash} {
+ set args {}
+ foreach {k v} [array get bighash] {
+ set newval [randstring 0 8 alpha]
+ set bighash($k) $newval
+ lappend args $k $newval
+ }
+ $r hmset bighash {*}$args
+ } {OK}
test {HKEYS - small hash} {
lsort [$r hkeys smallhash]