summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-22 10:06:43 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-11-22 10:06:43 +0100
commit7c33f2666bd60a4bba1a67c155b11b757b043904 (patch)
treeb60f96cae49c8a285639c2b9edbfeaccb5a5464e
parentcb89a472b65691df93b1469a577ec94857f37855 (diff)
Make test for formatting commands using a vector more robust
-rw-r--r--test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test.c b/test.c
index eb7790b..41d9a87 100644
--- a/test.c
+++ b/test.c
@@ -73,9 +73,9 @@ static void test_format_commands() {
const char *argv[3];
argv[0] = "SET";
- argv[1] = "foo";
+ argv[1] = "foo\0xxx";
argv[2] = "bar";
- size_t lens[3] = { 3, 3, 3 };
+ size_t lens[3] = { 3, 7, 3 };
int argc = 3;
test("Format command by passing argc/argv without lengths: ");
@@ -86,8 +86,8 @@ static void test_format_commands() {
test("Format command by passing argc/argv with lengths: ");
len = redisFormatCommandArgv(&cmd,argc,argv,lens);
- test_cond(strncmp(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));
+ 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);
}