diff options
author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-15 17:04:08 +0100 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-08-15 17:04:08 +0100 |
commit | 35a870a7a23c7d6076c658c1ec2122b642f264ed (patch) | |
tree | b9ce5b562cf1a297844a7983c6b3fe33bb536d23 /tests/check_check_log_internal.c | |
download | check-35a870a7a23c7d6076c658c1ec2122b642f264ed.tar.gz |
Tarball conversion
Diffstat (limited to 'tests/check_check_log_internal.c')
-rw-r--r-- | tests/check_check_log_internal.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/check_check_log_internal.c b/tests/check_check_log_internal.c new file mode 100644 index 0000000..50b114b --- /dev/null +++ b/tests/check_check_log_internal.c @@ -0,0 +1,55 @@ +#include "../lib/libcompat.h" + +/* Tests for log related stuff in check which need non-exported functions. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <check.h> +#include <check_list.h> +#include <check_impl.h> +#include <check_log.h> +#include "check_check.h" + + +#if ENABLE_SUBUNIT +START_TEST(test_init_logging_subunit) +{ + /* init_logging with CK_SUBUNIT sets stdout + * to a subunit function, not any log. + */ + Log * first_log = NULL; + Suite *s = suite_create("Suite"); + SRunner *sr = srunner_create(s); + srunner_init_logging(sr, CK_SUBUNIT); + list_front (sr->loglst); + fail_if (list_at_end(sr->loglst), "No entries in log list"); + first_log = list_val(sr->loglst); + fail_if (first_log == NULL, "log is NULL"); + list_advance(sr->loglst); + fail_unless(list_at_end(sr->loglst), "More than one entry in log list"); + fail_unless(first_log->lfun == subunit_lfun, + "Log function is not the subunit lfun."); + srunner_end_logging(sr); + srunner_free(sr); +} +END_TEST +#endif + +Suite *make_log_internal_suite(void) +{ + + Suite *s; + TCase *tc_core_subunit; + + s = suite_create("Log"); + tc_core_subunit = tcase_create("Core SubUnit"); + +#if ENABLE_SUBUNIT + suite_add_tcase(s, tc_core_subunit); + tcase_add_test(tc_core_subunit, test_init_logging_subunit); +#endif + + return s; +} + |