mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 08:56:15 +01:00
Silence log handler tests
This commit is contained in:
parent
b91cde6140
commit
2b113e4a9a
@ -45,6 +45,7 @@ test_assertions (void)
|
|||||||
g_assert_cmpstr ("foo", <, "fzz");
|
g_assert_cmpstr ("foo", <, "fzz");
|
||||||
g_assert_cmpstr ("fzz", >, "faa");
|
g_assert_cmpstr ("fzz", >, "faa");
|
||||||
g_assert_cmpstr ("fzz", ==, "fzz");
|
g_assert_cmpstr ("fzz", ==, "fzz");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test g_test_timer* API */
|
/* test g_test_timer* API */
|
||||||
@ -201,18 +202,23 @@ fatal_handler (const gchar *log_domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_log_handler (void)
|
test_fatal_log_handler (void)
|
||||||
{
|
{
|
||||||
g_test_log_set_fatal_handler (fatal_handler, NULL);
|
g_test_log_set_fatal_handler (fatal_handler, NULL);
|
||||||
|
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
|
||||||
|
{
|
||||||
g_str_has_prefix (NULL, "file://");
|
g_str_has_prefix (NULL, "file://");
|
||||||
g_critical ("Test passing");
|
g_critical ("Test passing");
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
g_test_trap_assert_passed ();
|
||||||
|
|
||||||
g_test_log_set_fatal_handler (NULL, NULL);
|
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_error ("Test failing");
|
||||||
g_test_trap_assert_failed ();
|
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_str_has_prefix (NULL, "file://");
|
||||||
g_test_trap_assert_failed ();
|
g_test_trap_assert_failed ();
|
||||||
}
|
}
|
||||||
@ -235,7 +241,7 @@ main (int argc,
|
|||||||
g_test_add_func ("/forking/patterns", test_fork_patterns);
|
g_test_add_func ("/forking/patterns", test_fork_patterns);
|
||||||
if (g_test_slow())
|
if (g_test_slow())
|
||||||
g_test_add_func ("/forking/timeout", test_fork_timeout);
|
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();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user