#include <setjmp.h> /* for fatal tests */
+/* To test the firing of i_assert, we need non-local jumps, i.e. setjmp */
+static volatile bool expecting_fatal = FALSE;
+static jmp_buf fatal_jmpbuf;
+
#define OUT_NAME_ALIGN 70
static char *test_prefix;
void test_begin(const char *name)
{
- i_assert(test_prefix == NULL);
- test_prefix = i_strdup(name);
test_success = TRUE;
+ if (!expecting_fatal)
+ i_assert(test_prefix == NULL);
+ else
+ test_assert((test_success = (test_prefix == NULL)));
+ test_prefix = i_strdup(name);
}
bool test_has_failed(void)
void test_end(void)
{
- i_assert(test_prefix != NULL);
+ if (!expecting_fatal)
+ i_assert(test_prefix != NULL);
+ else
+ test_assert(test_prefix != NULL);
test_out("", test_success);
if (!test_success)
test_success = FALSE;
}
-/* To test the firing of i_assert, we need non-local jumps, i.e. setjmp */
-static volatile bool expecting_fatal = FALSE;
-static jmp_buf fatal_jmpbuf;
-
static void ATTR_FORMAT(2, 0) ATTR_NORETURN
test_fatal_handler(const struct failure_context *ctx,
const char *format, va_list args)