diff options
author | Alex Smith <aes7mv@virginia.edu> | 2020-10-15 18:17:35 -0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2021-02-25 21:25:17 -0800 |
commit | 790b4d3b4da0687a475e8a42724fbf6739bbd947 (patch) | |
tree | c423f41a74e78a44892590415e102009943a02f1 | |
parent | d8899fbc190d49bb09c2576035d4db4ead185846 (diff) |
test: Add test cases for RESP3 nil
-rw-r--r-- | test.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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) { |