Mercurial > dovecot > core-2.2
view src/lib-imap/test-imap-quote.c @ 17130:add8c00fb3cc
Updated copyright notices to include year 2014.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 04 Feb 2014 16:23:22 -0500 |
parents | 714320c3cfa6 |
children | 3009a1a6f6d5 |
line wrap: on
line source
/* Copyright (c) 2013-2014 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "str.h" #include "imap-quote.h" #include "test-common.h" static void test_imap_append_string_for_humans(void) { static struct { const char *input, *output; } tests[] = { { "", "\"\"" }, { " ", "\"\"" }, { " ", "\"\"" }, { "\t", "\"\"" }, { " \t", "\"\"" }, { " \t ", "\"\"" }, { " foo", "{3}\r\nfoo" }, { "\tfoo", "{3}\r\nfoo" }, { "\t \tfoo", "{3}\r\nfoo" }, { " foo ", "{3}\r\nfoo" }, { " foo ", "{3}\r\nfoo" }, { " foo \t \t", "{3}\r\nfoo" } }; string_t *str = t_str_new(128); unsigned int i; test_begin("imap_append_string_for_humans()"); for (i = 0; i < N_ELEMENTS(tests); i++) { str_truncate(str, 0); imap_append_string_for_humans(str, (const void *)tests[i].input, strlen(tests[i].input)); test_assert(strcmp(tests[i].output, str_c(str)) == 0); } test_end(); } int main(void) { static void (*test_functions[])(void) = { test_imap_append_string_for_humans, NULL }; return test_run(test_functions); }