void double_item_breadcrumb_does_calls_walker_only_once() { expect(mock_walker, want_string(name, "Hello")); expect(mock_walker, want_string(name, "Goodbye")); Breadcrumb *breadcrumb = create_breadcrumb(); push_breadcrumb(breadcrumb, "Hello"); push_breadcrumb(breadcrumb, "Goodbye"); walk_breadcrumb(breadcrumb, &mock_walker, NULL); }
static void show_fail(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { int i = 0; printf("%s:%d: ", file, line); printf("Failure: "); walk_breadcrumb((CgreenBreadcrumb *) reporter->breadcrumb, &show_breadcrumb, (void *) &i); printf("\n\t"); vprintf((message == NULL ? "<NULL for failure message>" : message), arguments); printf("\n"); printf("\n"); fflush(NULL); }
static void show_incomplete(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { int i = 0; printf("%s:%d: ", file, line); printf("Exception: "); walk_breadcrumb((CgreenBreadcrumb *) reporter->breadcrumb, &show_breadcrumb, (void *) &i); printf("\n\t"); vprintf(message ? message: "Test terminated unexpectedly, likely from a non-standard exception or Posix signal", arguments); printf("\n"); printf("\n"); fflush(NULL); }
static void show_fail(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { char buffer[1000]; TextMemo *memo = (TextMemo *)reporter->memo; memo->printer("%s:%d: ", file, line); memo->printer("Failure: "); memo->depth = 0; walk_breadcrumb((CgreenBreadcrumb *) reporter->breadcrumb, &show_breadcrumb, memo); memo->printer("\n\t"); vsprintf(buffer, (message == NULL ? "<FATAL: NULL for failure message>" : message), arguments); memo->printer(buffer); memo->printer("\n"); memo->printer("\n"); fflush(NULL); }
static void show_incomplete(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { char buffer[1000]; TextMemo *memo = (TextMemo *)reporter->memo; memo->printer("%s:%d: ", file, line); memo->printer("Exception: "); memo->depth = 0; walk_breadcrumb((CgreenBreadcrumb *) reporter->breadcrumb, &show_breadcrumb, memo); memo->printer("\n\t"); vsprintf(buffer, message ? message: "Test terminated unexpectedly, likely from a non-standard exception or Posix signal", arguments); memo->printer(buffer); memo->printer("\n"); memo->printer("\n"); fflush(NULL); }
static void show_fail(TestReporter *reporter, const char *file, int line, const char *message, va_list arguments) { char buffer[1000]; TextMemo *memo = (TextMemo *)reporter->memo; memo->printer("%s:%d: ", file, line); memo->printer("Failure: "); memo->depth = 0; walk_breadcrumb((CgreenBreadcrumb *) reporter->breadcrumb, &show_breadcrumb, memo); memo->printer("\n\t"); // Simplify *printf statements for more robust cross-platform logging if (message == NULL) { vsprintf(buffer, "<FATAL: NULL for failure message>", arguments); } else { vsprintf(buffer, message, arguments); } memo->printer("%s", buffer); memo->printer("\n"); memo->printer("\n"); fflush(NULL); }
void empty_breadcrumb_does_not_trigger_walker() { expect_never(mock_walker); Breadcrumb *breadcrumb = create_breadcrumb(); walk_breadcrumb(breadcrumb, &mock_walker, NULL); }