summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authorAxel Etcheverry <euskadi31@gmail.com>2013-11-14 01:59:35 +0100
committerMatt Stancliff <matt@genges.com>2014-04-09 17:02:42 -0400
commit66192a0052ec3f9936099a4d2c5512b4b0d89bf0 (patch)
tree6b16c54137f6644fab9cb1b20d5168eaefda3156 /test.c
parentf20f5ad10264a10d41aa2a47c029fba71820d62a (diff)
Add new redisAppendFormatedCommand with tests
Closes #202
Diffstat (limited to 'test.c')
-rw-r--r--test.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test.c b/test.c
index e937624..713cc06 100644
--- a/test.c
+++ b/test.c
@@ -217,6 +217,28 @@ static void test_format_commands(void) {
free(cmd);
}
+static void test_append_formatted_commands(struct config config) {
+ redisContext *c;
+ redisReply *reply;
+ char *cmd;
+ int len;
+
+ c = connect(config);
+
+ test("Append format command: ");
+
+ len = redisFormatCommand(&cmd, "SET foo bar");
+
+ test_cond(redisAppendFormattedCommand(c, cmd, len) == REDIS_OK);
+
+ assert(redisGetReply(c, (void*)&reply) == REDIS_OK);
+
+ free(cmd);
+ freeReplyObject(reply);
+
+ disconnect(c, 0);
+}
+
static void test_reply_reader(void) {
redisReader *reader;
void *reply;
@@ -686,6 +708,7 @@ int main(int argc, char **argv) {
test_blocking_connection(cfg);
test_blocking_io_errors(cfg);
test_invalid_timeout_errors(cfg);
+ test_append_formatted_commands(cfg);
if (throughput) test_throughput(cfg);
printf("\nTesting against Unix socket connection (%s):\n", cfg.unix.path);