diff --git a/glib/tests/testing.c b/glib/tests/testing.c index ef8bcf98d..6b5be0bd7 100644 --- a/glib/tests/testing.c +++ b/glib/tests/testing.c @@ -45,6 +45,7 @@ test_assertions (void) g_assert_cmpstr ("foo", <, "fzz"); g_assert_cmpstr ("fzz", >, "faa"); g_assert_cmpstr ("fzz", ==, "fzz"); + } /* test g_test_timer* API */ @@ -201,18 +202,23 @@ fatal_handler (const gchar *log_domain, } static void -test_log_handler (void) +test_fatal_log_handler (void) { g_test_log_set_fatal_handler (fatal_handler, NULL); - g_str_has_prefix (NULL, "file://"); - g_critical ("Test passing"); + if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) + { + g_str_has_prefix (NULL, "file://"); + g_critical ("Test passing"); + exit (0); + } + g_test_trap_assert_passed (); g_test_log_set_fatal_handler (NULL, NULL); - if (g_test_trap_fork (0, 0)) + if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) g_error ("Test failing"); g_test_trap_assert_failed (); - if (g_test_trap_fork (0, 0)) + if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) g_str_has_prefix (NULL, "file://"); g_test_trap_assert_failed (); } @@ -235,7 +241,7 @@ main (int argc, g_test_add_func ("/forking/patterns", test_fork_patterns); if (g_test_slow()) g_test_add_func ("/forking/timeout", test_fork_timeout); - g_test_add_func ("/misc/log-handler", test_log_handler); + g_test_add_func ("/misc/fatal-log-handler", test_fatal_log_handler); return g_test_run(); }