From a20a8a9fcde3e7f4e01458542320c9a9b78c40da Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 9 Sep 2016 03:05:39 +0300 Subject: [PATCH] lib-test: test_expect_errors() now works for the entire log string, not just format parameter --- src/lib-test/test-common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index b026492d52..4b60c5012f 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -298,12 +298,15 @@ test_error_handler(const struct failure_context *ctx, bool suppress = FALSE; 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;