[glib] GTest: Improve --help output



commit bf3262dd935ecbe72374311447de1f1c70a43fcc
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 16 20:18:37 2012 -0400

    GTest: Improve --help output
    
    https://bugzilla.gnome.org/show_bug.cgi?id=550433

 glib/gtester.c    |   33 ++++++++++++++--------------
 glib/gtestutils.c |   61 ++++++++++++++++++++--------------------------------
 2 files changed, 41 insertions(+), 53 deletions(-)
---
diff --git a/glib/gtester.c b/glib/gtester.c
index 279f6f2..89f9294 100644
--- a/glib/gtester.c
+++ b/glib/gtester.c
@@ -474,23 +474,24 @@ usage (gboolean just_version)
       g_print ("gtester version %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
       return;
     }
-  g_print ("Usage: gtester [OPTIONS] testprogram...\n");
+  g_print ("Usage:\n");
+  g_print ("gtester [OPTIONS] testprogram...\n\n");
   /*        12345678901234567890123456789012345678901234567890123456789012345678901234567890 */
-  g_print ("Options:\n");
-  g_print ("  -h, --help                  show this help message\n");
-  g_print ("  -v, --version               print version informations\n");
-  g_print ("  --g-fatal-warnings          make warnings fatal (abort)\n");
-  g_print ("  -k, --keep-going            continue running after tests failed\n");
-  g_print ("  -l                          list paths of available test cases\n");
-  g_print ("  -m=perf, -m=slow, -m=quick -m=thorough\n");
-  g_print ("                              run test cases in mode perf, slow/thorough or quick (default)\n");
-  g_print ("  -m=no-undefined             don't run test cases that provoke assertions\n");
-  g_print ("  -p=TESTPATH                 only start test cases matching TESTPATH\n");
-  g_print ("  -s=TESTPATH                 skip test cases matching TESTPATH\n");
-  g_print ("  --seed=SEEDSTRING           start all tests with random number seed SEEDSTRING\n");
-  g_print ("  -o=LOGFILE                  write the test log to LOGFILE\n");
-  g_print ("  -q, --quiet                 suppress per test binary output\n");
-  g_print ("  --verbose                   report success per testcase\n");
+  g_print ("Help Options:\n");
+  g_print ("  -h, --help                    Show this help message\n\n");
+  g_print ("Utility Options:\n");
+  g_print ("  -v, --version                 Print version informations\n");
+  g_print ("  --g-fatal-warnings            Make warnings fatal (abort)\n");
+  g_print ("  -k, --keep-going              Continue running after tests failed\n");
+  g_print ("  -l                            List paths of available test cases\n");
+  g_print ("  -m {perf|slow|thorough|quick} Run test cases according to mode\n");
+  g_print ("  -m {undefined|no-undefined}   Run test cases according to mode\n");
+  g_print ("  -p=TESTPATH                   Only start test cases matching TESTPATH\n");
+  g_print ("  -s=TESTPATH                   Skip test cases matching TESTPATH\n");
+  g_print ("  --seed=SEEDSTRING             Start tests with random seed SEEDSTRING\n");
+  g_print ("  -o=LOGFILE                    Write the test log to LOGFILE\n");
+  g_print ("  -q, --quiet                   Suppress per test binary output\n");
+  g_print ("  --verbose                     Report success per testcase\n");
 }
 
 static void
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index ffdbea3..2e3b415 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -784,26 +784,25 @@ parse_args (gint    *argc_p,
             }
           argv[i] = NULL;
         }
-      else if (strcmp ("-?", argv[i]) == 0 || strcmp ("--help", argv[i]) == 0)
+      else if (strcmp ("-?", argv[i]) == 0 ||
+               strcmp ("-h", argv[i]) == 0 ||
+               strcmp ("--help", argv[i]) == 0)
         {
           printf ("Usage:\n"
                   "  %s [OPTION...]\n\n"
                   "Help Options:\n"
-                  "  -?, --help                     Show help options\n"
+                  "  -h, --help                     Show help options\n\n"
                   "Test Options:\n"
+                  "  --g-fatal-warnings             Make all warnings fatal\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"
-                  "  -s TESTPATH                    skip all tests matching TESTPATH\n"
-                  "  -m {perf|slow|thorough|quick}  Execute tests according modes\n"
-                  "  -m {undefined|no-undefined}    Execute tests according modes\n"
+                  "  -m {perf|slow|thorough|quick}  Execute tests according to mode\n"
+                  "  -m {undefined|no-undefined}    Execute tests according to mode\n"
+                  "  -p TESTPATH                    Only start test cases matching TESTPATH\n"
+                  "  -s TESTPATH                    Skip all tests matching TESTPATH\n"
+                  "  -seed=SEEDSTRING               Start tests with random seed SEEDSTRING\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",
+                  "  -q, --quiet                    Run tests quietly\n"
+                  "  --verbose                      Run tests verbosely\n",
                   argv[0]);
           exit (0);
         }
@@ -836,57 +835,57 @@ parse_args (gint    *argc_p,
  *   <varlistentry>
  *     <term><option>-l</option></term>
  *     <listitem><para>
- *       list test cases available in a test executable.
+ *       List test cases available in a test executable.
  *     </para></listitem>
  *   </varlistentry>
  *   <varlistentry>
  *     <term><option>--seed=<replaceable>RANDOMSEED</replaceable></option></term>
  *     <listitem><para>
- *       provide a random seed to reproduce test runs using random numbers.
+ *       Provide a random seed to reproduce test runs using random numbers.
  *     </para></listitem>
  *     </varlistentry>
  *     <varlistentry>
  *       <term><option>--verbose</option></term>
- *       <listitem><para>run tests verbosely.</para></listitem>
+ *       <listitem><para>Run tests verbosely.</para></listitem>
  *     </varlistentry>
  *     <varlistentry>
  *       <term><option>-q</option>, <option>--quiet</option></term>
- *       <listitem><para>run tests quietly.</para></listitem>
+ *       <listitem><para>Run tests quietly.</para></listitem>
  *     </varlistentry>
  *     <varlistentry>
  *       <term><option>-p <replaceable>TESTPATH</replaceable></option></term>
  *       <listitem><para>
- *         execute all tests matching <replaceable>TESTPATH</replaceable>.
+ *         Execute all tests matching <replaceable>TESTPATH</replaceable>.
  *       </para></listitem>
  *     </varlistentry>
  *     <varlistentry>
  *       <term><option>-m {perf|slow|thorough|quick|undefined|no-undefined}</option></term>
  *       <listitem><para>
- *         execute tests according to these test modes:
+ *         Execute tests according to these test modes:
  *         <variablelist>
  *           <varlistentry>
  *             <term>perf</term>
  *             <listitem><para>
- *               performance tests, may take long and report results.
+ *               Performance tests, may take long and report results.
  *             </para></listitem>
  *           </varlistentry>
  *           <varlistentry>
  *             <term>slow, thorough</term>
  *             <listitem><para>
- *               slow and thorough tests, may take quite long and 
+ *               Slow and thorough tests, may take quite long and
  *               maximize coverage.
  *             </para></listitem>
  *           </varlistentry>
  *           <varlistentry>
  *             <term>quick</term>
  *             <listitem><para>
- *               quick tests, should run really quickly and give good coverage.
+ *               Quick tests, should run really quickly and give good coverage.
  *             </para></listitem>
  *           </varlistentry>
  *           <varlistentry>
  *             <term>undefined</term>
  *             <listitem><para>
- *               tests for undefined behaviour, may provoke programming errors
+ *               Tests for undefined behaviour, may provoke programming errors
  *               under g_test_trap_fork() to check that appropriate assertions
  *               or warnings are given
  *             </para></listitem>
@@ -894,7 +893,7 @@ parse_args (gint    *argc_p,
  *           <varlistentry>
  *             <term>no-undefined</term>
  *             <listitem><para>
- *               avoid tests for undefined behaviour
+ *               Avoid tests for undefined behaviour
  *             </para></listitem>
  *           </varlistentry>
  *         </variablelist>
@@ -902,19 +901,7 @@ parse_args (gint    *argc_p,
  *     </varlistentry>
  *     <varlistentry>
  *       <term><option>--debug-log</option></term>
- *       <listitem><para>debug test logging output.</para></listitem>
- *     </varlistentry>
- *     <varlistentry>
- *       <term><option>-k</option>, <option>--keep-going</option></term>
- *       <listitem><para>gtester-specific argument.</para></listitem>
- *     </varlistentry>
- *     <varlistentry>
- *       <term><option>--GTestLogFD <replaceable>N</replaceable></option></term>
- *       <listitem><para>gtester-specific argument.</para></listitem>
- *     </varlistentry>
- *     <varlistentry>
- *       <term><option>--GTestSkipCount <replaceable>N</replaceable></option></term>
- *       <listitem><para>gtester-specific argument.</para></listitem>
+ *       <listitem><para>Debug test logging output.</para></listitem>
  *     </varlistentry>
  *  </variablelist>
  *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]