mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 02:17:51 +02:00
tests: port from g_test_trap_subprocess() to g_test_trap_fork()
(or, in a few cases, to g_test_expect_message()) https://bugzilla.gnome.org/show_bug.cgi?id=679683
This commit is contained in:
committed by
Matthias Clasen
parent
e3a29184d5
commit
ea06ec8063
@@ -260,6 +260,20 @@ test_find_program (void)
|
||||
g_assert (res == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
test_debug_help (void)
|
||||
{
|
||||
GDebugKey keys[] = {
|
||||
{ "key1", 1 },
|
||||
{ "key2", 2 },
|
||||
{ "key3", 4 },
|
||||
};
|
||||
guint res;
|
||||
|
||||
res = g_parse_debug_string ("help", keys, G_N_ELEMENTS (keys));
|
||||
g_assert_cmpint (res, ==, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
test_debug (void)
|
||||
{
|
||||
@@ -294,12 +308,7 @@ test_debug (void)
|
||||
res = g_parse_debug_string ("all", keys, G_N_ELEMENTS (keys));
|
||||
g_assert_cmpint (res, ==, 7);
|
||||
|
||||
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
|
||||
{
|
||||
res = g_parse_debug_string ("help", keys, G_N_ELEMENTS (keys));
|
||||
g_assert_cmpint (res, ==, 0);
|
||||
exit (0);
|
||||
}
|
||||
g_test_trap_subprocess ("/utils/debug:help", 0, G_TEST_TRAP_SILENCE_STDERR);
|
||||
g_test_trap_assert_passed ();
|
||||
g_test_trap_assert_stderr ("*Supported debug values: key1 key2 key3 all help*");
|
||||
}
|
||||
@@ -535,6 +544,7 @@ main (int argc,
|
||||
g_test_add_func ("/utils/swap", test_swap);
|
||||
g_test_add_func ("/utils/find-program", test_find_program);
|
||||
g_test_add_func ("/utils/debug", test_debug);
|
||||
g_test_add_func ("/utils/debug:help", test_debug_help);
|
||||
g_test_add_func ("/utils/codeset", test_codeset);
|
||||
g_test_add_func ("/utils/basename", test_basename);
|
||||
g_test_add_func ("/utils/gettext", test_gettext);
|
||||
|
Reference in New Issue
Block a user