]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-test: test_expect_errors() now works for the entire log string, not just format...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 9 Sep 2016 00:05:39 +0000 (03:05 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 9 Sep 2016 11:28:36 +0000 (14:28 +0300)
src/lib-test/test-common.c

index 6a10170a6f80abe076b6501199f9181b16df1c4d..1ab4b9b5363392e06f5524c430f2d15acc965bdc 100644 (file)
@@ -306,12 +306,15 @@ test_error_handler(const struct failure_context *ctx,
        }
 #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;