Mercurial > dovecot > core-2.2
view src/lib-imap/test-imap-quote.c @ 18137:3009a1a6f6d5
global: freshen copyright
Robomatically:
git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-4]/$1-2015/g;s/ (201[0-4]) Dovecot/ $1-2015 Dovecot/'
Happy 2015 everyone!
Signed-off-by: Phil Carmody <phil@dovecot.fi>
author | Phil Carmody <phil@dovecot.fi> |
---|---|
date | Mon, 05 Jan 2015 22:20:10 +0200 |
parents | add8c00fb3cc |
children | 326711633532 |
line wrap: on
line source
/* Copyright (c) 2013-2015 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); }