Simplify subprocesses in tests

Use the new way of running tests in a subprocess without
registering extra 'subprocess' test cases where appropriate.
This commit is contained in:
Matthias Clasen
2013-12-15 11:20:19 -05:00
parent cd2204bb65
commit c34cc2348c
9 changed files with 179 additions and 222 deletions

View File

@@ -117,19 +117,18 @@ my_infanticide_object_class_init (MyInfanticideObjectClass *klass)
object_class->constructor = my_infanticide_object_constructor;
}
static void
test_object_constructor_infanticide_subprocess (void)
{
g_object_new (my_infanticide_object_get_type (), NULL);
g_assert_not_reached ();
}
static void
test_object_constructor_infanticide (void)
{
g_test_bug ("661576");
g_test_trap_subprocess ("/object/constructor/infanticide/subprocess", 0, 0);
if (g_test_subprocess ())
{
g_object_new (my_infanticide_object_get_type (), NULL);
g_assert_not_reached ();
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*finalized while still in-construction*");
g_test_trap_assert_stderr_unmatched ("*reached*");
@@ -145,7 +144,6 @@ main (int argc, char *argv[])
g_test_add_func ("/object/constructor/singleton", test_object_constructor_singleton);
g_test_add_func ("/object/constructor/infanticide", test_object_constructor_infanticide);
g_test_add_func ("/object/constructor/infanticide/subprocess", test_object_constructor_infanticide_subprocess);
return g_test_run ();
}