Esempio n. 1
0
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);
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
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);
}
Esempio n. 5
0
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);
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
void empty_breadcrumb_does_not_trigger_walker() {
    expect_never(mock_walker);
    Breadcrumb *breadcrumb = create_breadcrumb();
    walk_breadcrumb(breadcrumb, &mock_walker, NULL);
}