summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Smith <aes7mv@virginia.edu>2020-10-15 18:17:35 -0400
committermichael-grunder <michael.grunder@gmail.com>2021-02-25 21:25:17 -0800
commit790b4d3b4da0687a475e8a42724fbf6739bbd947 (patch)
treec423f41a74e78a44892590415e102009943a02f1
parentd8899fbc190d49bb09c2576035d4db4ead185846 (diff)
test: Add test cases for RESP3 nil
-rw-r--r--test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test.c b/test.c
index 19cbd89..5deff7a 100644
--- a/test.c
+++ b/test.c
@@ -616,6 +616,24 @@ static void test_reply_reader(void) {
strcasecmp(reader->errstr,"Bad double value") == 0);
freeReplyObject(reply);
redisReaderFree(reader);
+
+ test("Can parse RESP3 nil: ");
+ reader = redisReaderCreate();
+ redisReaderFeed(reader, "_\r\n",3);
+ ret = redisReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_OK &&
+ ((redisReply*)reply)->type == REDIS_REPLY_NIL);
+ freeReplyObject(reply);
+ redisReaderFree(reader);
+
+ test("Set error on invalid RESP3 nil: ");
+ reader = redisReaderCreate();
+ redisReaderFeed(reader, "_nil\r\n",6);
+ ret = redisReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_ERR &&
+ strcasecmp(reader->errstr,"Bad nil value") == 0);
+ freeReplyObject(reply);
+ redisReaderFree(reader);
}
static void test_free_null(void) {