Skip to content

Commit

Permalink
added more tests for the integer reply parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Dec 19, 2010
1 parent 16404e2 commit 3c148f9
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion t/sanity.t
Expand Up @@ -98,7 +98,7 @@ res == Bad argument\rHey\n"
=== TEST 3: good integer reply
=== TEST 4: good integer reply
--- sql
--- lua
parser = require("redis.parser")
Expand All @@ -112,3 +112,35 @@ typ == 3 == 3
res == -32
res type == number
=== TEST 5: non-numeric integer reply
--- sql
--- lua
parser = require("redis.parser")
reply = ':abc\r\n'
res, typ = parser.parse_reply(reply)
print("typ == " .. typ .. ' == ' .. parser.INTEGER_REPLY)
print("res == " .. res)
print("res type == " .. type(res))
--- out
typ == 3 == 3
res == 0
res type == number
=== TEST 6: bad integer reply
--- sql
--- lua
parser = require("redis.parser")
reply = ':12\r'
res, typ = parser.parse_reply(reply)
print("typ == " .. typ .. ' == ' .. parser.BAD_REPLY)
print("res == " .. res)
print("res type == " .. type(res))
--- out
typ == 0 == 0
res == bad integer reply
res type == string

0 comments on commit 3c148f9

Please sign in to comment.