]> git.saurik.com Git - redis.git/blobdiff - test-redis.tcl
Remove trailing whitespace.
[redis.git] / test-redis.tcl
index 43672254431887bbbef0e9e4a9809247314281e2..371b26e5c76c6eccfde5bfa3f7f4c2e5bc45323e 100644 (file)
@@ -234,7 +234,7 @@ proc main {server port} {
 
     # 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
@@ -831,7 +831,7 @@ proc main {server port} {
     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]
@@ -920,7 +920,7 @@ proc main {server port} {
         }
         lsort [array names myset]
     } {a b c}
-    
+
     test {Create a random list and a random set} {
         set tosort {}
         array set seenrand {}
@@ -1489,6 +1489,11 @@ proc main {server port} {
         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
@@ -1609,6 +1614,13 @@ proc main {server port} {
         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]
@@ -1626,12 +1638,30 @@ proc main {server port} {
         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]