Skip to content

Commit

Permalink
lib-test: test_expect_errors() now works for the entire log string, n…
Browse files Browse the repository at this point in the history
…ot just format parameter
  • Loading branch information
sirainen committed Sep 9, 2016
1 parent 4b93550 commit a20a8a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib-test/test-common.c
Expand Up @@ -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;
Expand Down

0 comments on commit a20a8a9

Please sign in to comment.