summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authornot-a-robot <not-a-robot@rediger.net>2016-05-14 11:45:18 +0200
committernot-a-robot <not-a-robot@rediger.net>2016-05-14 11:45:18 +0200
commite30db1a3bea4ad464470dc22be9280c0ef58f4c1 (patch)
tree994fca157b0334c27924c2b4be1647c50720196c /test.c
parente93c05a7aa64736c91e455322c83181e8e67cd0e (diff)
parent8655a6ac7a1bdd9b04d669585b4ae430c167ad80 (diff)
Auto merge of #427 - redis:pr-426, r=badboy
Pr 426 Closes #426, now with test
Diffstat (limited to 'test.c')
-rw-r--r--test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test.c b/test.c
index 538d376..a23d606 100644
--- a/test.c
+++ b/test.c
@@ -224,6 +224,22 @@ static void test_format_commands(void) {
test_cond(strncmp(cmd,"*3\r\n$3\r\nSET\r\n$7\r\nfoo\0xxx\r\n$3\r\nbar\r\n",len) == 0 &&
len == 4+4+(3+2)+4+(7+2)+4+(3+2));
free(cmd);
+
+ sds sds_cmd;
+
+ sds_cmd = sdsempty();
+ test("Format command into sds by passing argc/argv without lengths: ");
+ len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,NULL);
+ test_cond(strncmp(sds_cmd,"*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n",len) == 0 &&
+ len == 4+4+(3+2)+4+(3+2)+4+(3+2));
+ sdsfree(sds_cmd);
+
+ sds_cmd = sdsempty();
+ test("Format command into sds by passing argc/argv with lengths: ");
+ len = redisFormatSdsCommandArgv(&sds_cmd,argc,argv,lens);
+ test_cond(strncmp(sds_cmd,"*3\r\n$3\r\nSET\r\n$7\r\nfoo\0xxx\r\n$3\r\nbar\r\n",len) == 0 &&
+ len == 4+4+(3+2)+4+(7+2)+4+(3+2));
+ sdsfree(sds_cmd);
}
static void test_append_formatted_commands(struct config config) {