[glib: 6/8] Test what happens when GTestSkipCount is 0 or more than number of tests
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 6/8] Test what happens when GTestSkipCount is 0 or more than number of tests
- Date: Mon, 29 Apr 2019 15:46:55 +0000 (UTC)
commit dfec3c67891745130c5babca1300a180b6f9d059
Author: Simon McVittie <smcv collabora com>
Date: Mon Apr 29 16:02:09 2019 +0100
Test what happens when GTestSkipCount is 0 or more than number of tests
Using --GTestSkipCount 0 is the same as omitting it. A skip count
greater than the number of tests is the same as equalling the number
of tests: they are all skipped.
Signed-off-by: Simon McVittie <smcv collabora com>
glib/tests/testing.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
---
diff --git a/glib/tests/testing.c b/glib/tests/testing.c
index bd82ff7dd..99be65a44 100644
--- a/glib/tests/testing.c
+++ b/glib/tests/testing.c
@@ -1091,6 +1091,60 @@ test_tap (void)
g_free (output);
g_ptr_array_unref (argv);
+ g_test_message ("--GTestSkipCount=0 is the same as omitting it");
+ argv = g_ptr_array_new ();
+ g_ptr_array_add (argv, (char *) testing_helper);
+ g_ptr_array_add (argv, "skip-options");
+ g_ptr_array_add (argv, "--tap");
+ g_ptr_array_add (argv, "--GTestSkipCount");
+ g_ptr_array_add (argv, "0");
+ g_ptr_array_add (argv, NULL);
+
+ g_spawn_sync (NULL, (char **) argv->pdata, NULL,
+ G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL, NULL, &output, NULL, &status,
+ &error);
+ g_assert_no_error (error);
+ g_assert_nonnull (strstr (output, "1..5\n"));
+ g_assert_nonnull (strstr (output, "\nok 1 /a\n"));
+ g_assert_nonnull (strstr (output, "\nok 2 /b/a\n"));
+ g_assert_nonnull (strstr (output, "\nok 3 /b/b\n"));
+ g_assert_nonnull (strstr (output, "\nok 4 /c/a\n"));
+ g_assert_nonnull (strstr (output, "\nok 5 /d/a\n"));
+
+ g_spawn_check_exit_status (status, &error);
+ g_assert_no_error (error);
+
+ g_free (output);
+ g_ptr_array_unref (argv);
+
+ g_test_message ("--GTestSkipCount > number of tests skips all");
+ argv = g_ptr_array_new ();
+ g_ptr_array_add (argv, (char *) testing_helper);
+ g_ptr_array_add (argv, "skip-options");
+ g_ptr_array_add (argv, "--tap");
+ g_ptr_array_add (argv, "--GTestSkipCount");
+ g_ptr_array_add (argv, "6");
+ g_ptr_array_add (argv, NULL);
+
+ g_spawn_sync (NULL, (char **) argv->pdata, NULL,
+ G_SPAWN_STDERR_TO_DEV_NULL,
+ NULL, NULL, &output, NULL, &status,
+ &error);
+ g_assert_no_error (error);
+ g_assert_nonnull (strstr (output, "1..5\n"));
+ g_assert_nonnull (strstr (output, "\nok 1 /a # SKIP\n"));
+ g_assert_nonnull (strstr (output, "\nok 2 /b/a # SKIP\n"));
+ g_assert_nonnull (strstr (output, "\nok 3 /b/b # SKIP\n"));
+ g_assert_nonnull (strstr (output, "\nok 4 /c/a # SKIP\n"));
+ g_assert_nonnull (strstr (output, "\nok 5 /d/a # SKIP\n"));
+
+ g_spawn_check_exit_status (status, &error);
+ g_assert_no_error (error);
+
+ g_free (output);
+ g_ptr_array_unref (argv);
+
g_test_message ("-p");
argv = g_ptr_array_new ();
g_ptr_array_add (argv, (char *) testing_helper);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]