summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2011-03-06 11:38:07 +0100
committerPieter Noordhuis <pcnoordhuis@gmail.com>2011-03-06 11:38:07 +0100
commit8e2c39200d2a643180b1bc07aaa234056d5354f4 (patch)
treecb3dc0066b572aa36ce6d943d4bb4f2496c2afd1 /test.c
parentbf544ce81c55f6ae64470efeec04f368dec9ac3d (diff)
Fix formatCommand to work with all empty interpolations
Diffstat (limited to 'test.c')
-rw-r--r--test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test.c b/test.c
index bc82a1e..e9173a0 100644
--- a/test.c
+++ b/test.c
@@ -54,6 +54,12 @@ static void test_format_commands(void) {
len == 4+4+(3+2)+4+(3+2)+4+(0+2));
free(cmd);
+ test("Format command with an empty string in between proper interpolations: ");
+ len = redisFormatCommand(&cmd,"SET %s %s","","foo");
+ test_cond(strncmp(cmd,"*3\r\n$3\r\nSET\r\n$0\r\n\r\n$3\r\nfoo\r\n",len) == 0 &&
+ len == 4+4+(3+2)+4+(0+2)+4+(3+2));
+ free(cmd);
+
test("Format command with %%b string interpolation: ");
len = redisFormatCommand(&cmd,"SET %b %b","foo",3,"b\0r",3);
test_cond(strncmp(cmd,"*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nb\0r\r\n",len) == 0 &&