Mercurial > dovecot > core-2.2
changeset 20714:2ac556536f25
lib-test: test_expect_errors() now works for the entire log string, not just format parameter
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 09 Sep 2016 03:05:39 +0300 |
parents | 3d0aecd0b2bc |
children | b5bf847c215c |
files | src/lib-test/test-common.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-test/test-common.c Tue Aug 09 18:29:19 2016 +0300 +++ b/src/lib-test/test-common.c Fri Sep 09 03:05:39 2016 +0300 @@ -306,12 +306,15 @@ } #endif if (expected_errors > 0) { - if (expected_error_str != NULL) { + if (expected_error_str != NULL) T_BEGIN { /* test_assert() will reset test_success if need be. */ - suppress = strstr(format, expected_error_str) != NULL; + va_list args2; + VA_COPY(args2, args); + const char *str = t_strdup_vprintf(format, args2); + suppress = strstr(str, expected_error_str) != NULL; test_assert(suppress == TRUE); i_free_and_null(expected_error_str); - } + } T_END; expected_errors--; } else { test_success = FALSE;