summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-01-27 14:39:34 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-01-27 14:39:34 +0100
commit663d6d1258b3ef49178ed4120de5c91ecffe2512 (patch)
treec4a728c661a72a053ea9bc73271b01765f8a6720 /test.c
parent864bce944be1331c70ed353aeb083607c2a31acc (diff)
Properly reset state after protocol error in reply reader
Diffstat (limited to 'test.c')
-rw-r--r--test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test.c b/test.c
index 8017356..bc82a1e 100644
--- a/test.c
+++ b/test.c
@@ -318,6 +318,15 @@ static void test_reply_reader(void) {
ret = redisReplyReaderGetReply(reader,&reply);
test_cond(ret == REDIS_OK && reply == (void*)REDIS_REPLY_STATUS);
redisReplyReaderFree(reader);
+
+ test("Properly reset state after protocol error: ");
+ reader = redisReplyReaderCreate();
+ redisReplyReaderSetReplyObjectFunctions(reader,NULL);
+ redisReplyReaderFeed(reader,(char*)"x",1);
+ ret = redisReplyReaderGetReply(reader,&reply);
+ assert(ret == REDIS_ERR);
+ ret = redisReplyReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_OK && reply == NULL)
}
static void test_throughput(void) {