]> git.saurik.com Git - redis.git/blobdiff - test-redis.tcl
Don't exit with error in tests temp file cleanup if there are no files to clean
[redis.git] / test-redis.tcl
index 8f71c6241c68e1f1f710282253fdb44ac7d38296..3b5900f96894acf32f8a0baf5d271818fd97fafa 100644 (file)
@@ -191,45 +191,7 @@ proc createComplexDataset {r ops} {
 }
 
 proc datasetDigest r {
-    set keys [lsort [$r keys *]]
-    set digest {}
-    foreach k $keys {
-        set t [$r type $k]
-        switch $t {
-            {string} {
-                set aux [::sha1::sha1 -hex [$r get $k]]
-            } {list} {
-                if {[$r llen $k] == 0} {
-                    set aux {}
-                } else {
-                    set aux [::sha1::sha1 -hex [$r lrange $k 0 -1]]
-                }
-            } {set} {
-                if {[$r scard $k] == 0} {
-                    set aux {}
-                } else {
-                    set aux [::sha1::sha1 -hex [lsort [$r smembers $k]]]
-                }
-            } {zset} {
-                if {[$r zcard $k] == 0} {
-                    set aux {}
-                } else {
-                    set aux [::sha1::sha1 -hex [$r zrange $k 0 -1]]
-                }
-            } {hash} {
-                if {[$r hlen $k] == 0} {
-                    set aux {}
-                } else {
-                    set aux [::sha1::sha1 -hex [lsort [$r hgetall $k]]]
-                }
-            } default {
-                error "Type not supported: $t"
-            }
-        }
-        if {$aux eq {}} continue
-        set digest [::sha1::sha1 -hex [join [list $aux $digest $k] "\n"]]
-    }
-    return $digest
+    $r debug digest
 }
 
 proc main {} {
@@ -373,7 +335,7 @@ proc main {} {
 
     test {INCR fails against a key holding a list} {
         $r rpush mylist 1
-        catch {$r incr novar} err
+        catch {$r incr mylist} err
         $r rpop mylist
         format $err
     } {ERR*}
@@ -1898,11 +1860,15 @@ proc main {} {
         list [$r hincrby smallhash tmp 17179869184] [$r hincrby bighash tmp 17179869184]
     } {34359738368 34359738368}
 
-    test {HINCRBY against key with spaces (no integer encoded)} {
-        $r hset smallhash tmp "    11    "
-        $r hset bighash tmp "    11    "
-        list [$r hincrby smallhash tmp 1] [$r hincrby bighash tmp 1]
-    } {12 12}
+    test {HINCRBY fails against hash value with spaces} {
+        $r hset smallhash str "    11    "
+        $r hset bighash str "    11    "
+        catch {$r hincrby smallhash str 1} smallerr
+        catch {$r hincrby smallhash str 1} bigerr
+        set rv {}
+        lappend rv [string match "ERR*not an integer*" $smallerr]
+        lappend rv [string match "ERR*not an integer*" $bigerr]
+    } {1 1}
 
     # TODO:
     # Randomized test, small and big