diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-03-06 11:38:07 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-03-06 11:38:07 +0100 |
commit | 8e2c39200d2a643180b1bc07aaa234056d5354f4 (patch) | |
tree | cb3dc0066b572aa36ce6d943d4bb4f2496c2afd1 /test.c | |
parent | bf544ce81c55f6ae64470efeec04f368dec9ac3d (diff) |
Fix formatCommand to work with all empty interpolations
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 && |