X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/9fcfd6b6512dd975ba3eadf476b7d5670c9dbb79..73db2acc374c99ca8224e44a7383f69e7ca24a4f:/tests/unit/basic.tcl?ds=sidebyside diff --git a/tests/unit/basic.tcl b/tests/unit/basic.tcl index 0d50fa1b..a8f7feb0 100644 --- a/tests/unit/basic.tcl +++ b/tests/unit/basic.tcl @@ -148,12 +148,11 @@ start_server {tags {"basic"}} { r get novar2 } {foobared} - test {SETNX will overwrite EXPIREing key} { + test {SETNX against volatile key} { r set x 10 r expire x 10000 - r setnx x 20 - r get x - } {20} + list [r setnx x 20] [r get x] + } {0 10} test {EXISTS} { set res {} @@ -362,10 +361,17 @@ start_server {tags {"basic"}} { list [r msetnx x1 xxx y2 yyy] [r get x1] [r get y2] } {1 xxx yyy} - test {MSETNX should remove all the volatile keys even on failure} { - r mset x 1 y 2 z 3 - r expire y 10000 - r expire z 10000 - list [r msetnx x A y B z C] [r mget x y z] - } {0 {1 {} {}}} + test {STRLEN against non existing key} { + r strlen notakey + } {0} + + test {STRLEN against integer} { + r set myinteger -555 + r strlen myinteger + } {4} + + test {STRLEN against plain string} { + r set mystring "foozzz0123456789 baz" + r strlen mystring + } }