diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2016-05-04 09:11:36 +0200 |
---|---|---|
committer | Salvatore Sanfilippo <antirez@gmail.com> | 2016-05-04 09:11:36 +0200 |
commit | b5352eea51f2881d13ec4e3e1fa90cea037d4f29 (patch) | |
tree | 8b705e791db2d44bf0aac8df2ebe789a8d36e36f /tests | |
parent | 2c22f59c3f3d02ffa995bd35ec333bd712718f96 (diff) | |
parent | 5e3880a492efd6c305d7bde5be44c1de72e15cb0 (diff) | |
download | redis-b5352eea51f2881d13ec4e3e1fa90cea037d4f29.tar.gz |
Merge pull request #3191 from oranagra/minor_fix
Minor fixes found during merge and code review
Diffstat (limited to 'tests')
-rw-r--r-- | tests/support/test.tcl | 6 | ||||
-rw-r--r-- | tests/unit/bitops.tcl | 2 | ||||
-rw-r--r-- | tests/unit/other.tcl | 1 | ||||
-rw-r--r-- | tests/unit/scripting.tcl | 27 |
4 files changed, 16 insertions, 20 deletions
diff --git a/tests/support/test.tcl b/tests/support/test.tcl index 31371c567..d60eb3c47 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -37,13 +37,7 @@ proc assert_error {pattern code} { } proc assert_encoding {enc key} { - # Swapped out values don't have an encoding, so make sure that - # the value is swapped in before checking the encoding. set dbg [r debug object $key] - while {[string match "* swapped at:*" $dbg]} { - r debug swapin $key - set dbg [r debug object $key] - } assert_match "* encoding:$enc *" $dbg } diff --git a/tests/unit/bitops.tcl b/tests/unit/bitops.tcl index 309a5d460..30aa832c7 100644 --- a/tests/unit/bitops.tcl +++ b/tests/unit/bitops.tcl @@ -88,7 +88,7 @@ start_server {tags {"bitops"}} { } {ERR*syntax*} test {BITCOUNT regression test for github issue #582} { - r del str + r del foo r setbit foo 0 1 if {[catch {r bitcount foo 0 4294967296} e]} { assert_match {*ERR*out of range*} $e diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index a53f3f5c8..2f5773930 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -194,6 +194,7 @@ start_server {tags {"other"}} { } test {APPEND basics} { + r del foo list [r append foo bar] [r get foo] \ [r append foo 100] [r get foo] } {3 bar 6 bar100} diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl index 0efe86ad6..07553b1d6 100644 --- a/tests/unit/scripting.tcl +++ b/tests/unit/scripting.tcl @@ -62,18 +62,19 @@ start_server {tags {"scripting"}} { } {NOSCRIPT*} test {EVAL - Redis integer -> Lua type conversion} { + r set x 0 r eval { - local foo = redis.pcall('incr','x') + local foo = redis.pcall('incr',KEYS[1]) return {type(foo),foo} - } 0 + } 1 x } {number 1} test {EVAL - Redis bulk -> Lua type conversion} { r set mykey myval r eval { - local foo = redis.pcall('get','mykey') + local foo = redis.pcall('get',KEYS[1]) return {type(foo),foo} - } 0 + } 1 mykey } {string myval} test {EVAL - Redis multi bulk -> Lua type conversion} { @@ -82,39 +83,39 @@ start_server {tags {"scripting"}} { r rpush mylist b r rpush mylist c r eval { - local foo = redis.pcall('lrange','mylist',0,-1) + local foo = redis.pcall('lrange',KEYS[1],0,-1) return {type(foo),foo[1],foo[2],foo[3],# foo} - } 0 + } 1 mylist } {table a b c 3} test {EVAL - Redis status reply -> Lua type conversion} { r eval { - local foo = redis.pcall('set','mykey','myval') + local foo = redis.pcall('set',KEYS[1],'myval') return {type(foo),foo['ok']} - } 0 + } 1 mykey } {table OK} test {EVAL - Redis error reply -> Lua type conversion} { r set mykey myval r eval { - local foo = redis.pcall('incr','mykey') + local foo = redis.pcall('incr',KEYS[1]) return {type(foo),foo['err']} - } 0 + } 1 mykey } {table {ERR value is not an integer or out of range}} test {EVAL - Redis nil bulk reply -> Lua type conversion} { r del mykey r eval { - local foo = redis.pcall('get','mykey') + local foo = redis.pcall('get',KEYS[1]) return {type(foo),foo == false} - } 0 + } 1 mykey } {boolean 1} test {EVAL - Is the Lua client using the currently selected DB?} { r set mykey "this is DB 9" r select 10 r set mykey "this is DB 10" - r eval {return redis.pcall('get','mykey')} 0 + r eval {return redis.pcall('get',KEYS[1])} 1 mykey } {this is DB 10} test {EVAL - SELECT inside Lua should not affect the caller} { |