summaryrefslogtreecommitdiff
path: root/deps/hiredis/test.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-04 13:35:47 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-04 13:35:47 +0100
commitafc156c2d8a2e2433528c0559bd2d38345e96a36 (patch)
treef3a73fbf8cc4422b6ee2ccfb924440790a2a3a57 /deps/hiredis/test.c
parent8df3dcada5e34c6a99666931ee6dcccd57685353 (diff)
downloadredis-afc156c2d8a2e2433528c0559bd2d38345e96a36.tar.gz
Update hiredis
Diffstat (limited to 'deps/hiredis/test.c')
-rw-r--r--deps/hiredis/test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/deps/hiredis/test.c b/deps/hiredis/test.c
index 9afc6fa44..995456ed3 100644
--- a/deps/hiredis/test.c
+++ b/deps/hiredis/test.c
@@ -186,11 +186,12 @@ static void test_blocking_connection() {
static void test_reply_reader() {
void *reader;
+ void *reply;
char *err;
int ret;
test("Error handling in reply parser: ");
- reader = redisReplyReaderCreate(NULL);
+ reader = redisReplyReaderCreate();
redisReplyReaderFeed(reader,(char*)"@foo\r\n",6);
ret = redisReplyReaderGetReply(reader,NULL);
err = redisReplyReaderGetError(reader);
@@ -201,7 +202,7 @@ static void test_reply_reader() {
/* when the reply already contains multiple items, they must be free'd
* on an error. valgrind will bark when this doesn't happen. */
test("Memory cleanup in reply parser: ");
- reader = redisReplyReaderCreate(NULL);
+ reader = redisReplyReaderCreate();
redisReplyReaderFeed(reader,(char*)"*2\r\n",4);
redisReplyReaderFeed(reader,(char*)"$5\r\nhello\r\n",11);
redisReplyReaderFeed(reader,(char*)"@foo\r\n",6);
@@ -210,6 +211,14 @@ static void test_reply_reader() {
test_cond(ret == REDIS_ERR &&
strcasecmp(err,"protocol error, got \"@\" as reply type byte") == 0);
redisReplyReaderFree(reader);
+
+ test("Works with NULL functions for reply: ");
+ reader = redisReplyReaderCreate();
+ redisReplyReaderSetReplyObjectFunctions(reader,NULL);
+ redisReplyReaderFeed(reader,(char*)"+OK\r\n",5);
+ ret = redisReplyReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_OK && reply == (void*)REDIS_REPLY_STATUS);
+ redisReplyReaderFree(reader);
}
static void test_throughput() {