Skip to content

Commit

Permalink
test.lua: testing TYPE
Browse files Browse the repository at this point in the history
It is special, since it creates new status const-objects
  • Loading branch information
agladysh committed Jun 28, 2012
1 parent 89a5b57 commit 19ebf45
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test.lua
Expand Up @@ -57,11 +57,29 @@ assert(assert(conn:command("GET", "MYKEY")) == "MYVALUE")

--------------------------------------------------------------------------------

local T = assert(conn:command("TYPE", "MYKEY"))
assert(type(T) == "table")
assert(T.type == hiredis.REPLY_STATUS)
assert(T.name == "string")

assert(hiredis.unwrap_reply(T) == "string")

--------------------------------------------------------------------------------

local NIL = assert(conn:command("GET", "BADKEY"))
assert(NIL == hiredis.NIL)

--------------------------------------------------------------------------------

local T = assert(conn:command("TYPE", "BADKEY2"))
assert(type(T) == "table")
assert(T.type == hiredis.REPLY_STATUS)
assert(T.name == "none")

assert(hiredis.unwrap_reply(T) == "none")

--------------------------------------------------------------------------------

local err = assert(conn:command("SET"))
assert(err.type == hiredis.REPLY_ERROR)
assert(err.name == "ERR wrong number of arguments for 'set' command")
Expand Down

0 comments on commit 19ebf45

Please sign in to comment.