mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
tests: Fix error handling when testing gtestutils
We had two compensating bugs here. We didn't correctly clear the error indicator after testing a test-case that calls g_test_fail(), which meant we were leaving the error set to exit status 1 when falling through to the next test; and then we didn't check the exit status of the next test, but instead assumed that g_spawn_sync() would fail (it does not). Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
709df8eeb4
commit
b006403c4e
@ -1136,6 +1136,7 @@ test_tap (void)
|
|||||||
g_assert_error (error, G_SPAWN_EXIT_ERROR, 1);
|
g_assert_error (error, G_SPAWN_EXIT_ERROR, 1);
|
||||||
g_assert_nonnull (strstr (output, "\nnot ok 1 /fail\n"));
|
g_assert_nonnull (strstr (output, "\nnot ok 1 /fail\n"));
|
||||||
g_free (output);
|
g_free (output);
|
||||||
|
g_clear_error (&error);
|
||||||
g_ptr_array_unref (argv);
|
g_ptr_array_unref (argv);
|
||||||
|
|
||||||
g_test_message ("all");
|
g_test_message ("all");
|
||||||
@ -1149,6 +1150,9 @@ test_tap (void)
|
|||||||
G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
|
G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
|
||||||
NULL, NULL, NULL, NULL, &status,
|
NULL, NULL, NULL, NULL, &status,
|
||||||
&error);
|
&error);
|
||||||
|
g_assert_no_error (error);
|
||||||
|
|
||||||
|
g_spawn_check_wait_status (status, &error);
|
||||||
g_assert_error (error, G_SPAWN_EXIT_ERROR, 1);
|
g_assert_error (error, G_SPAWN_EXIT_ERROR, 1);
|
||||||
g_clear_error (&error);
|
g_clear_error (&error);
|
||||||
g_ptr_array_unref (argv);
|
g_ptr_array_unref (argv);
|
||||||
|
Loading…
Reference in New Issue
Block a user