diff options
Diffstat (limited to 'tests/unit/type/string.tcl')
-rw-r--r-- | tests/unit/type/string.tcl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unit/type/string.tcl b/tests/unit/type/string.tcl index b25a14f4c..68c360b97 100644 --- a/tests/unit/type/string.tcl +++ b/tests/unit/type/string.tcl @@ -151,6 +151,14 @@ start_server {tags {"string"}} { set ex } {*syntax*} + test "GETEX and GET expired key or not exist" { + r del foo + r set foo bar px 1 + after 2 + assert_equal {} [r getex foo] + assert_equal {} [r get foo] + } + test "GETEX no arguments" { set ex {} catch {r getex} ex @@ -438,6 +446,11 @@ start_server {tags {"string"}} { assert_equal "" [r getrange mykey 0 -1] } + test "GETRANGE against wrong key type" { + r lpush lkey1 "list" + assert_error {WRONGTYPE Operation against a key holding the wrong kind of value*} {r getrange lkey1 0 -1} + } + test "GETRANGE against string value" { r set mykey "Hello World" assert_equal "Hell" [r getrange mykey 0 3] @@ -474,6 +487,9 @@ start_server {tags {"string"}} { assert_equal "a" [r substr key 0 0] assert_equal "abcd" [r substr key 0 3] assert_equal "bcde" [r substr key -4 -1] + assert_equal "" [r substr key -1 -3] + assert_equal "" [r substr key 7 8] + assert_equal "" [r substr nokey 0 1] } if {[string match {*jemalloc*} [s mem_allocator]]} { |