Mercurial > dovecot > core-2.2
view src/lib-dict/test-dict.c @ 22325:e01bc3015b2f
lib-index: Check .log.2 rotation only when syncing
Instead of also whenever appending transactions to .log file. This
shouldn't change the behavior much, and it's needed for the following
change to work correctly.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 11 Jul 2017 15:33:56 +0300 |
parents | 2e2563132d5f |
children | cb108f786fb4 |
line wrap: on
line source
/* Copyright (c) 2010-2017 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "dict-private.h" #include "test-common.h" struct dict dict_driver_client; struct dict dict_driver_file; struct dict dict_driver_memcached; struct dict dict_driver_memcached_ascii; struct dict dict_driver_redis; static void test_dict_escape(void) { static const char *input[] = { "", "", "foo", "foo", "foo\\", "foo\\\\", "foo\\bar", "foo\\\\bar", "\\bar", "\\\\bar", "foo/", "foo\\|", "foo/bar", "foo\\|bar", "/bar", "\\|bar", "////", "\\|\\|\\|\\|", "/", "\\|" }; unsigned int i; test_begin("dict escape"); for (i = 0; i < N_ELEMENTS(input); i += 2) { test_assert(strcmp(dict_escape_string(input[i]), input[i+1]) == 0); test_assert(strcmp(dict_unescape_string(input[i+1]), input[i]) == 0); } test_assert(strcmp(dict_unescape_string("x\\"), "x") == 0); test_assert(strcmp(dict_unescape_string("\\"), "") == 0); test_end(); } int main(void) { static void (*test_functions[])(void) = { test_dict_escape, NULL }; return test_run(test_functions); }