From 2201cae29ab4558f9cda70a65eeaa73683baeb64 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 8 Sep 2008 08:25:29 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20550433=20=E2=80=93=20g=5Ftest=5Finit=20do?= =?UTF-8?q?esn't=20recognize=20--help?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * glib/gtestutils.c (parse_args): Add detailed --help output svn path=/trunk/; revision=7442 --- ChangeLog | 6 ++++++ glib/gtestutils.c | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ChangeLog b/ChangeLog index 45ad19b80..3590fb848 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-09-08 Christian Dywan + + Bug 550433 – g_test_init doesn't recognize --help + + * glib/gtestutils.c (parse_args): Add detailed --help output + 2008-09-02 Matthias Clasen * configure.in: Bump version diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 8c0eb1ff3..179a3d78e 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -228,6 +228,9 @@ g_test_log (GTestLogType lbit, } } +/* We intentionally parse the command line without GOptionContext + * because otherwise you would never be able to test it. + */ static void parse_args (gint *argc_p, gchar ***argv_p) @@ -347,6 +350,27 @@ parse_args (gint *argc_p, } argv[i] = NULL; } + else if (strcmp ("-?", argv[i]) == 0 || strcmp ("--help", argv[i]) == 0) + { + printf ("Usage:\n" + " %s [OPTION...]\n\n" + "Help Options:\n" + " -?, --help Show help options\n" + "Test Options:\n" + " -l List test cases available in a test executable\n" + " -seed=RANDOMSEED Provide a random seed to reproduce test\n" + " runs using random numbers\n" + " --verbose Run tests verbosely\n" + " -q, --quiet Run tests quietly\n" + " -p TESTPATH execute all tests matching TESTPATH\n" + " -m {perf|slow|thorough|quick} Execute tests according modes\n" + " --debug-log debug test logging output\n" + " -k, --keep-going gtester-specific argument\n" + " --GTestLogFD=N gtester-specific argument\n" + " --GTestSkipCount=N gtester-specific argument\n", + argv[0]); + exit (0); + } } /* collapse argv */ e = 1;