diff options
author | Michael Grunder <michael.grunder@gmail.com> | 2020-05-21 11:12:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 11:12:18 -0700 |
commit | 83bba659b9dbd6c77baf2ff27ff6342317869a3e (patch) | |
tree | fde9796e555b926aa5822fed02691859b84ee2e8 /test.c | |
parent | c8999c66024b0de347adecb774d14963c08a66db (diff) |
Add logic to handle RESP3 push messages (#819)
Fixes #815
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -488,6 +488,21 @@ static void test_reply_reader(void) { !memcmp(((redisReply*)reply)->str,"LOLWUT", 6)); freeReplyObject(reply); redisReaderFree(reader); + + /* RESP3 push messages (Github issue #815) */ + test("Can parse RESP3 push messages: "); + reader = redisReaderCreate(); + redisReaderFeed(reader,(char*)">2\r\n$6\r\nLOLWUT\r\n:42\r\n",21); + ret = redisReaderGetReply(reader,&reply); + test_cond(ret == REDIS_OK && + ((redisReply*)reply)->type == REDIS_REPLY_PUSH && + ((redisReply*)reply)->elements == 2 && + ((redisReply*)reply)->element[0]->type == REDIS_REPLY_STRING && + !memcmp(((redisReply*)reply)->element[0]->str,"LOLWUT",6) && + ((redisReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER && + ((redisReply*)reply)->element[1]->integer == 42); + freeReplyObject(reply); + redisReaderFree(reader); } static void test_free_null(void) { |