Thu Sep 18 12:58:05 2008 Google Inc. <opensource@google.com>
authorCraig Silverstein <csilvers+gflags@google.com>
Fri, 19 Sep 2008 19:32:05 +0000 (19:32 +0000)
committerCraig Silverstein <csilvers+gflags@google.com>
Fri, 19 Sep 2008 19:32:05 +0000 (19:32 +0000)
* google-gflags: version 1.0rc2
* Report current flag values in --helpxml (hdn)
* Fix compilation troubles with gcc 4.3.3 (simonb)
* BUG FIX: I was missing a std:: in DECLARE_string (csilvers)
* BUG FIX: Clarify in docs how to specify --bool flags (csilvers)
* BUG FIX: Fix --helpshort for source files not in a subdir (csilvers)
* BUG FIX: Fix python unittest for 64-bit builds (bcmills)

git-svn-id: https://gflags.googlecode.com/svn/trunk@27 6586e3c6-dcc4-952a-343f-ff74eb82781d

16 files changed:
ChangeLog
INSTALL
configure
configure.ac
doc/gflags.html
gflags_unittest-main.cc [deleted file]
gflags_unittest_main.cc [deleted file]
packages/deb/changelog
packages/rpm/rpm.spec
python/gflags_unittest.py
src/gflags.cc
src/gflags/gflags.h.in
src/gflags_completions.cc
src/gflags_reporting.cc
src/gflags_unittest.cc
src/gflags_unittest.sh

index f9f7102..2f942ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,14 @@
-Tue Aug 19 16:15:48 2008  Google Inc. <opensource@google.com>
+Thu Sep 18 12:58:05 2008  Google Inc. <opensource@google.com>
+
+       * google-gflags: version 1.0rc2
+       * Report current flag values in --helpxml (hdn)
+       * Fix compilation troubles with gcc 4.3.3 (simonb)
+       * BUG FIX: I was missing a std:: in DECLARE_string (csilvers)
+       * BUG FIX: Clarify in docs how to specify --bool flags (csilvers)
+       * BUG FIX: Fix --helpshort for source files not in a subdir (csilvers)
+       * BUG FIX: Fix python unittest for 64-bit builds (bcmills)
+       
+Tue Aug 19 16:15:48 2008
 
        * google-gflags: version 1.0rc1
        * Move #include files from google/ to gflags/ (csilvers)
diff --git a/INSTALL b/INSTALL
index 23e5f25..316e397 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,16 +1,14 @@
-Installation Instructions
-*************************
+Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
-Software Foundation, Inc.
-
-This file is free documentation; the Free Software Foundation gives
+   This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
 
+
 Basic Installation
 ==================
 
-These are generic installation instructions.
+   These are generic installation instructions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -70,9 +68,9 @@ The simplest way to compile this package is:
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -85,7 +83,7 @@ is an example:
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you must use a version of `make' that
 supports the `VPATH' variable, such as GNU `make'.  `cd' to the
@@ -102,19 +100,19 @@ for another architecture.
 Installation Names
 ==================
 
-By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc.  You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
-PREFIX as the prefix for installing programs and libraries.
-Documentation and other data files still use the regular prefix.
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
+options like `--bindir=PATH' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -125,7 +123,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
 Optional Features
 =================
 
-Some packages pay attention to `--enable-FEATURE' options to
+   Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -140,11 +138,11 @@ you can use the `configure' options `--x-includes=DIR' and
 Specifying the System Type
 ==========================
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -159,7 +157,7 @@ where SYSTEM can have one of these forms:
 need to know the machine type.
 
    If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
+use the `--target=TYPE' option to select the type of system they will
 produce code for.
 
    If you want to _use_ a cross compiler, that generates code for a
@@ -170,9 +168,9 @@ eventually be run) with `--host=TYPE'.
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -181,7 +179,7 @@ A warning: not all `configure' scripts look for a site script.
 Defining Variables
 ==================
 
-Variables not defined in a site shell script can be set in the
+   Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -189,18 +187,14 @@ them in the `configure' command line, using `VAR=value'.  For example:
 
      ./configure CC=/usr/local2/bin/gcc
 
-causes the specified `gcc' to be used as the C compiler (unless it is
-overridden in the site shell script).  Here is a another example:
-
-     /bin/bash ./configure CONFIG_SHELL=/bin/bash
-
-Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
-configuration-related scripts to be executed by `/bin/bash'.
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
 
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'
index db958d3..dfe48cc 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for gflags 1.0rc1.
+# Generated by GNU Autoconf 2.59 for gflags 1.0rc2.
 #
 # Report bugs to <opensource@google.com>.
 #
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='gflags'
 PACKAGE_TARNAME='gflags'
-PACKAGE_VERSION='1.0rc1'
-PACKAGE_STRING='gflags 1.0rc1'
+PACKAGE_VERSION='1.0rc2'
+PACKAGE_STRING='gflags 1.0rc2'
 PACKAGE_BUGREPORT='opensource@google.com'
 
 ac_unique_file="README"
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gflags 1.0rc1 to adapt to many kinds of systems.
+\`configure' configures gflags 1.0rc2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1020,7 +1020,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gflags 1.0rc1:";;
+     short | recursive ) echo "Configuration of gflags 1.0rc2:";;
    esac
   cat <<\_ACEOF
 
@@ -1163,7 +1163,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-gflags configure 1.0rc1
+gflags configure 1.0rc2
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1177,7 +1177,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by gflags $as_me 1.0rc1, which was
+It was created by gflags $as_me 1.0rc2, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1823,7 +1823,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gflags'
- VERSION='1.0rc1'
+ VERSION='1.0rc2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -21261,7 +21261,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by gflags $as_me 1.0rc1, which was
+This file was extended by gflags $as_me 1.0rc2, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21324,7 +21324,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-gflags config.status 1.0rc1
+gflags config.status 1.0rc2
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
index ab48ea4..00ba78a 100644 (file)
@@ -4,7 +4,7 @@
 # make sure we're interpreted by some minimal autoconf
 AC_PREREQ(2.57)
 
-AC_INIT(gflags, 1.0rc1, opensource@google.com)
+AC_INIT(gflags, 1.0rc2, opensource@google.com)
 # The argument here is just something that should be in the current directory
 # (for sanity checking)
 AC_CONFIG_SRCDIR(README)
index 5ac362b..b1058ff 100644 (file)
@@ -81,11 +81,11 @@ translates directly to Python.</p>
 
 <p> Defining a flag is easy: just use the appropriate macro for the
 type you want the flag to be, as defined at the bottom of
-<code>google/gflags.h</code>.  Here's an example file,
+<code>gflags/gflags.h</code>.  Here's an example file,
 <code>foo.cc</code>:</p>
 
 <pre>
-   #include &lt;google/gflags.h&gt;
+   #include &lt;gflags/gflags.h&gt;
 
    DEFINE_bool(big_menu, true, "Include 'advanced' options in the menu listing");
    DEFINE_string(languages, "english,french,german",
@@ -287,14 +287,12 @@ specify the "languages" flag:</p>
   <li> <code>app_containing_foo -languages "chinese,japanese,korean"</code>
 </ul>
 
-<p>For boolean flags, there are even more possibilities:</p>
+<p>For boolean flags, the possibilities are slightly different:</p>
 <ul>
   <li> <code>app_containing_foo --big_menu</code>
   <li> <code>app_containing_foo --nobig_menu</code>
   <li> <code>app_containing_foo --big_menu=true</code>
   <li> <code>app_containing_foo --big_menu=false</code>
-  <li> <code>app_containing_foo --big_menu true</code>
-  <li> <code>app_containing_foo --big_menu false</code>
 </ul>
 <p>(as well as the single-dash variant on all of these).</p>
 
@@ -477,7 +475,7 @@ methods such as <code>google::SetUsageMessage</code>, see
 <p>If your application has code like this:</p>
 <pre>
    #define STRIP_FLAG_HELP 1    // this must go before the #include!
-   #include &lt;google/gflags.h&gt;
+   #include &lt;gflags/gflags.h&gt;
 </pre>
 <p>we will remove the help messages from the compiled source. This can
 reduce the size of the resulting binary somewhat, and may also be
diff --git a/gflags_unittest-main.cc b/gflags_unittest-main.cc
deleted file mode 100644 (file)
index 3ec0333..0000000
+++ /dev/null
@@ -1,1125 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// ---
-// Author: Marius Eriksen
-//
-// For now, this unit test does not cover all features of
-// commandlineflags.cc
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>     // for unlink()
-#include <sys/stat.h>   // for mkdir()
-#include <math.h>       // for isinf() and isnan()
-#include <vector>
-#include <string>
-#include "google/gflags.h"
-
-using std::vector;
-using std::string;
-
-// Returns the number of elements in an array.  We don't use the safer
-// version in base/basictypes.h as commandlineflags is open-sourced.
-#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
-
-DECLARE_string(tryfromenv);   // in commandlineflags.cc
-
-DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files");
-DEFINE_string(srcdir, google::StringFromEnv("SRCDIR", "."),
-              "Source-dir root, needed to find gflags_unittest_flagfile");
-
-
-DEFINE_bool(test_bool, false, "tests bool-ness");
-DEFINE_int32(test_int32, -1, "");
-DEFINE_int64(test_int64, -2, "");
-DEFINE_uint64(test_uint64, 2, "");
-DEFINE_double(test_double, -1.0, "");
-DEFINE_string(test_string, "initial", "");
-
-//
-// The below ugliness gets some additional code coverage in the -helpxml
-// and -helpmatch test cases having to do with string lengths and formatting
-//
-DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name,
-            false,
-            "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning");
-
-DEFINE_string(test_str1, "initial", "");
-DEFINE_string(test_str2, "initial", "");
-DEFINE_string(test_str3, "initial", "");
-
-// This is used to test setting tryfromenv manually
-DEFINE_string(test_tryfromenv, "initial", "");
-
-// These are never used in this unittest, but can be used by
-// commandlineflags_unittest.sh when it needs to specify flags
-// that are legal for commandlineflags_unittest but don't need to
-// be a particular value.
-DEFINE_bool(unused_bool, true, "unused bool-ness");
-DEFINE_int32(unused_int32, -1001, "");
-DEFINE_int64(unused_int64, -2001, "");
-DEFINE_uint64(unused_uint64, 2000, "");
-DEFINE_double(unused_double, -1000.0, "");
-DEFINE_string(unused_string, "unused", "");
-
-_START_GOOGLE_NAMESPACE_
-
-// The following is some bare-bones testing infrastructure
-
-#define EXPECT_TRUE(cond)                               \
-  do {                                                  \
-    if (!(cond)) {                                      \
-      fprintf(stderr, "Check failed: %s\n", #cond);     \
-      exit(1);                                          \
-    }                                                   \
-  } while (0)
-
-#define EXPECT_FALSE(cond)  EXPECT_TRUE(!(cond))
-
-#define EXPECT_OP(op, val1, val2)                                       \
-  do {                                                                  \
-    if (!((val1) op (val2))) {                                          \
-      fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2);   \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-#define EXPECT_EQ(val1, val2)  EXPECT_OP(==, val1, val2)
-#define EXPECT_NE(val1, val2)  EXPECT_OP(!=, val1, val2)
-#define EXPECT_GT(val1, val2)  EXPECT_OP(>, val1, val2)
-#define EXPECT_LT(val1, val2)  EXPECT_OP(<, val1, val2)
-
-#define EXPECT_NAN(arg)                                         \
-  do {                                                          \
-    if (!isnan(arg)) {                                          \
-      fprintf(stderr, "Check failed: isnan(%s)\n", #arg);       \
-      exit(1);                                                  \
-    }                                                           \
-  } while (0)
-
-#define EXPECT_INF(arg)                                         \
-  do {                                                          \
-    if (!isinf(arg)) {                                          \
-      fprintf(stderr, "Check failed: isinf(%s)\n", #arg);       \
-      exit(1);                                                  \
-    }                                                           \
-  } while (0)
-
-#define EXPECT_DOUBLE_EQ(val1, val2)                                    \
-  do {                                                                  \
-    if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) {         \
-      fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2);        \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-#define EXPECT_STREQ(val1, val2)                                        \
-  do {                                                                  \
-    if (strcmp((val1), (val2)) != 0) {                                  \
-      fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2);   \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-static bool g_called_exit;
-static void CalledExit(int) { g_called_exit = true; }
-
-#define EXPECT_DEATH(fn, msg)                                           \
-  do {                                                                  \
-    g_called_exit = false;                                              \
-    extern void (*commandlineflags_exitfunc)(int);   /* in gflags.cc */ \
-    commandlineflags_exitfunc = &CalledExit;                            \
-    fn;                                                                 \
-    commandlineflags_exitfunc = &exit;    /* set back to its default */ \
-    if (!g_called_exit) {                                               \
-      fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn);      \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-
-vector<void (*)()> g_testlist;  // the tests to run
-
-#define TEST(a, b)                                      \
-  struct Test_##a##_##b {                               \
-    Test_##a##_##b() { g_testlist.push_back(&Run); }    \
-    static void Run() { FlagSaver fs; RunTest(); }      \
-    static void RunTest();                              \
-  };                                                    \
-  static Test_##a##_##b g_test_##a##_##b;               \
-  void Test_##a##_##b::RunTest()
-
-
-static int RUN_ALL_TESTS() {
-  vector<void (*)()>::const_iterator it;
-  for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
-    (*it)();
-  }
-  fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size());
-  return 0;
-}
-
-
-// Death tests for "help" options.
-//
-// The help system automatically calls exit(1) when you specify any of
-// the help-related flags ("-helpmatch", "-helpxml") so we can't test
-// those mainline.
-
-// Tests that "-helpmatch" causes the process to die.
-TEST(ReadFlagsFromStringDeathTest, HelpMatch) {
-  EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true),
-               "");
-}
-
-
-// Tests that "-helpxml" causes the process to die.
-TEST(ReadFlagsFromStringDeathTest, HelpXml) {
-  EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true),
-               "");
-}
-
-
-// A subroutine needed for testing reading flags from a string.
-void TestFlagString(const string& flags,
-                    const string& expected_string,
-                    bool expected_bool,
-                    int32 expected_int32,
-                    double expected_double) {
-  EXPECT_TRUE(ReadFlagsFromString(flags,
-                                  GetArgv0(),
-                                  // errors are fatal
-                                  true));
-
-  EXPECT_EQ(expected_string, FLAGS_test_string);
-  EXPECT_EQ(expected_bool, FLAGS_test_bool);
-  EXPECT_EQ(expected_int32, FLAGS_test_int32);
-  EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double);
-}
-
-
-// Tests reading flags from a string.
-TEST(FlagFileTest, ReadFlagsFromString) {
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "-test_double=0.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      0.0);
-
-  TestFlagString(
-      // Flag string
-      "# let's make sure it can update values\n"
-      "-test_string=initial\n"
-      "-test_bool=false\n"
-      "-test_int32=123\n"
-      "-test_double=123.0\n",
-      // Expected values
-      "initial",
-      false,
-      123,
-      123.0);
-}
-
-// Tests the filename part of the flagfile
-TEST(FlagFileTest, FilenamesOurfileLast) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "not_our_filename\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "gflags_unittest\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      false,
-      -1,
-      1000.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileFirst) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "gflags_unittest\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "not_our_filename\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileGlob) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "*flags*\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "flags\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileInBigList) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "*first* *flags* *third*\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "flags\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-// Tests that a failed flag-from-string read keeps flags at default values
-TEST(FlagFileTest, FailReadFlagsFromString) {
-  FLAGS_test_int32 = 119;
-  string flags("# let's make sure it can update values\n"
-               "-test_string=non_initial\n"
-               "-test_bool=false\n"
-               "-test_int32=123\n"
-               "-test_double=illegal\n");
-
-  EXPECT_FALSE(ReadFlagsFromString(flags,
-                                   GetArgv0(),
-                                   // errors are fatal
-                                   false));
-
-  EXPECT_EQ(119, FLAGS_test_int32);
-  EXPECT_EQ("initial", FLAGS_test_string);
-}
-
-// Tests that flags can be set to ordinary values.
-TEST(SetFlagValueTest, OrdinaryValues) {
-  EXPECT_EQ("initial", FLAGS_test_str1);
-
-  SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);  // set; was default
-
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);  // already set once
-
-  FLAGS_test_str1 = "initial";
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("initial", FLAGS_test_str1);  // still already set before
-
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE);
-  EXPECT_EQ("third", FLAGS_test_str1);  // changed value
-
-  SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str1);
-  // value not changed (already set before)
-
-  EXPECT_EQ("initial", FLAGS_test_str2);
-
-  SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str2);  // changed (was default)
-
-  FLAGS_test_str2 = "extra";
-  EXPECT_EQ("extra", FLAGS_test_str2);
-
-  FLAGS_test_str2 = "second";
-  SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str2);  // still changed (was equal to default)
-
-  SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("fourth", FLAGS_test_str2);  // changed (was default)
-
-  EXPECT_EQ("initial", FLAGS_test_str3);
-
-  SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str3);  // changed
-
-  FLAGS_test_str3 = "third";
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str3);  // not changed (was set)
-
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str3);  // not changed (was set)
-
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE);
-  EXPECT_EQ("fourth", FLAGS_test_str3);  // changed value
-}
-
-
-// Tests that flags can be set to exceptional values.
-TEST(SetFlagValueTest, ExceptionalValues) {
-  EXPECT_EQ("test_double set to inf\n",
-            SetCommandLineOption("test_double", "inf"));
-  EXPECT_INF(FLAGS_test_double);
-
-  EXPECT_EQ("test_double set to inf\n",
-            SetCommandLineOption("test_double", "INF"));
-  EXPECT_INF(FLAGS_test_double);
-
-  // set some bad values
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", "0.1xxx"));
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", " "));
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", ""));
-  EXPECT_EQ("test_double set to -inf\n",
-            SetCommandLineOption("test_double", "-inf"));
-  EXPECT_INF(FLAGS_test_double);
-  EXPECT_GT(0, FLAGS_test_double);
-
-  EXPECT_EQ("test_double set to nan\n",
-            SetCommandLineOption("test_double", "NaN"));
-  EXPECT_NAN(FLAGS_test_double);
-}
-
-// Tests that integer flags can be specified in many ways
-TEST(SetFlagValueTest, DifferentRadices) {
-  EXPECT_EQ("test_int32 set to 12\n",
-            SetCommandLineOption("test_int32", "12"));
-
-  EXPECT_EQ("test_int32 set to 16\n",
-            SetCommandLineOption("test_int32", "0x10"));
-
-  EXPECT_EQ("test_int32 set to 34\n",
-            SetCommandLineOption("test_int32", "0X22"));
-
-  // Leading 0 is *not* octal; it's still decimal
-  EXPECT_EQ("test_int32 set to 10\n",
-            SetCommandLineOption("test_int32", "010"));
-}
-
-// Tests what happens when you try to set a flag to an illegal value
-TEST(SetFlagValueTest, IllegalValues) {
-  FLAGS_test_bool = true;
-  FLAGS_test_int32 = 119;
-  FLAGS_test_int64 = 1191;
-  FLAGS_test_uint64 = 11911;
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_bool", "12"));
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_int32", "7000000000000"));
-
-  // TODO(csilvers): uncomment this when we disallow negative numbers for uint64
-#if 0
-  EXPECT_EQ("",
-            SetCommandLineOption("test_uint64", "-1"));
-#endif
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_int64", "not a number!"));
-
-  // Test the empty string with each type of input
-  EXPECT_EQ("", SetCommandLineOption("test_bool", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_int32", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_int64", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_uint64", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_double", ""));
-  EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", ""));
-
-  EXPECT_EQ(true, FLAGS_test_bool);
-  EXPECT_EQ(119, FLAGS_test_int32);
-  EXPECT_EQ(1191, FLAGS_test_int64);
-  EXPECT_EQ(11911, FLAGS_test_uint64);
-}
-
-
-// Tests that the FooFromEnv does the right thing
-TEST(FromEnvTest, LegalValues) {
-  setenv("BOOL_VAL1", "true", 1);
-  setenv("BOOL_VAL2", "false", 1);
-  setenv("BOOL_VAL3", "1", 1);
-  setenv("BOOL_VAL4", "F", 1);
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL1", false));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL2", true));
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL3", false));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL4", true));
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL_UNKNOWN", true));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL_UNKNOWN", false));
-
-  setenv("INT_VAL1", "1", 1);
-  setenv("INT_VAL2", "-1", 1);
-  EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10));
-  EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10));
-  EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10));
-
-  setenv("INT_VAL3", "1099511627776", 1);
-  EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20));
-  EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20));
-  EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20));
-  EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20));
-
-  EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30));
-  EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30));
-  EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30));
-
-  // I pick values here that can be easily represented exactly in floating-point
-  setenv("DOUBLE_VAL1", "0.0", 1);
-  setenv("DOUBLE_VAL2", "1.0", 1);
-  setenv("DOUBLE_VAL3", "-1.0", 1);
-  EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0));
-  EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0));
-  EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0));
-  EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0));
-
-  setenv("STRING_VAL1", "", 1);
-  setenv("STRING_VAL2", "my happy string!", 1);
-  EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown"));
-  EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown"));
-  EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown"));
-}
-
-// Tests that the FooFromEnv dies on parse-error
-TEST(FromEnvTest, IllegalValues) {
-  setenv("BOOL_BAD1", "so true!",1 );
-  setenv("BOOL_BAD2", "", 1);
-  EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable");
-  EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable");
-
-  setenv("INT_BAD1", "one", 1);
-  setenv("INT_BAD2", "100000000000000000", 1);
-  setenv("INT_BAD3", "0xx10", 1);
-  setenv("INT_BAD4", "", 1);
-  EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable");
-
-  setenv("BIGINT_BAD1", "18446744073709551616000", 1);
-  EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable");
-
-  setenv("BIGINT_BAD2", "-1", 1);
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable");
-  // TODO(csilvers): uncomment this when we disallow negative numbers for uint64
-#if 0
-  EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable");
-#endif
-
-  setenv("DOUBLE_BAD1", "0.0.0", 1);
-  setenv("DOUBLE_BAD2", "", 1);
-  EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable");
-  EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable");
-}
-
-// Tests that FlagSaver can save the states of string flags.
-TEST(FlagSaverTest, CanSaveStringFlagStates) {
-  // 1. Initializes the flags.
-
-  // State of flag test_str1:
-  //   default value - "initial"
-  //   current value - "initial"
-  //   not set       - true
-
-  SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE);
-  // State of flag test_str2:
-  //   default value - "initial"
-  //   current value - "second"
-  //   not set       - false
-
-  SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT);
-  // State of flag test_str3:
-  //   default value - "second"
-  //   current value - "second"
-  //   not set       - true
-
-  // 2. Saves the flag states.
-
-  {
-    FlagSaver fs;
-
-    // 3. Modifies the flag states.
-
-    SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE);
-    EXPECT_EQ("second", FLAGS_test_str1);
-    // State of flag test_str1:
-    //   default value - "second"
-    //   current value - "second"
-    //   not set       - true
-
-    SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT);
-    EXPECT_EQ("second", FLAGS_test_str2);
-    // State of flag test_str2:
-    //   default value - "third"
-    //   current value - "second"
-    //   not set       - false
-
-    SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE);
-    EXPECT_EQ("third", FLAGS_test_str3);
-    // State of flag test_str1:
-    //   default value - "second"
-    //   current value - "third"
-    //   not set       - false
-
-    // 4. Restores the flag states.
-  }
-
-  // 5. Verifies that the states were restored.
-
-  // Verifies that the value of test_str1 was restored.
-  EXPECT_EQ("initial", FLAGS_test_str1);
-  // Verifies that the "not set" attribute of test_str1 was restored to true.
-  SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);
-
-  // Verifies that the value of test_str2 was restored.
-  EXPECT_EQ("second", FLAGS_test_str2);
-  // Verifies that the "not set" attribute of test_str2 was restored to false.
-  SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str2);
-
-  // Verifies that the value of test_str3 was restored.
-  EXPECT_EQ("second", FLAGS_test_str3);
-  // Verifies that the "not set" attribute of test_str3 was restored to true.
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("fourth", FLAGS_test_str3);
-}
-
-
-// Tests that FlagSaver can save the values of various-typed flags.
-TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) {
-  // Initializes the flags.
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_int64 = -2;
-  FLAGS_test_uint64 = 3;
-  FLAGS_test_double = 4.0;
-  FLAGS_test_string = "good";
-
-  // Saves the flag states.
-  {
-    FlagSaver fs;
-
-    // Modifies the flags.
-    FLAGS_test_bool = true;
-    FLAGS_test_int32 = -5;
-    FLAGS_test_int64 = -6;
-    FLAGS_test_uint64 = 7;
-    FLAGS_test_double = 8.0;
-    FLAGS_test_string = "bad";
-
-    // Restores the flag states.
-  }
-
-  // Verifies the flag values were restored.
-  EXPECT_FALSE(FLAGS_test_bool);
-  EXPECT_EQ(-1, FLAGS_test_int32);
-  EXPECT_EQ(-2, FLAGS_test_int64);
-  EXPECT_EQ(3, FLAGS_test_uint64);
-  EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double);
-  EXPECT_EQ("good", FLAGS_test_string);
-}
-
-TEST(GetAllFlagsTest, BaseTest) {
-  vector<CommandLineFlagInfo> flags;
-  GetAllFlags(&flags);
-  bool found_test_bool = false;
-  vector<CommandLineFlagInfo>::const_iterator i;
-  for (i = flags.begin(); i != flags.end(); ++i) {
-    if (i->name == "test_bool") {
-      found_test_bool = true;
-      EXPECT_EQ(i->type, "bool");
-      EXPECT_EQ(i->default_value, "false");
-      break;
-    }
-  }
-  EXPECT_EQ(true, found_test_bool);
-}
-
-TEST(ShowUsageWithFlagsTest, BaseTest) {
-  // TODO(csilvers): test this by allowing output other than to stdout.
-  // Not urgent since this functionality is tested via
-  // gflags_unittest.sh, though only through use of --help.
-}
-
-TEST(ShowUsageWithFlagsRestrictTest, BaseTest) {
-  // TODO(csilvers): test this by allowing output other than to stdout.
-  // Not urgent since this functionality is tested via
-  // gflags_unittest.sh, though only through use of --helpmatch.
-}
-
-// Note: all these argv-based tests depend on SetArgv being called
-// before InitGoogle() in main(), below.
-TEST(GetArgvsTest, BaseTest) {
-  vector<string> argvs = GetArgvs();
-  EXPECT_EQ(4, argvs.size());
-  EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]);
-  EXPECT_EQ("argv 2", argvs[1]);
-  EXPECT_EQ("3rd argv", argvs[2]);
-  EXPECT_EQ("argv #4", argvs[3]);
-}
-
-TEST(GetArgvTest, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest "
-               "argv 2 3rd argv argv #4", GetArgv());
-}
-
-TEST(GetArgv0Test, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0());
-}
-
-TEST(GetArgvSumTest, BaseTest) {
-  // This number is just the sum of the ASCII values of all the chars
-  // in GetArgv().
-  EXPECT_EQ(4904, GetArgvSum());
-}
-
-TEST(ProgramInvocationNameTest, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest",
-               ProgramInvocationName());
-}
-
-TEST(ProgramInvocationShortNameTest, BaseTest) {
-  EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName());
-}
-
-TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main()
-  EXPECT_STREQ("/test/argv/for/gflags_unittest: "
-               "<useless flag> [...]\nDoes something useless.\n",
-               ProgramUsage());
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) {
-  string value("will be changed");
-  bool r = GetCommandLineOption("test_bool", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("false", value);
-
-  r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("-1", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) {
-  FLAGS_test_int32 = 400;
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("400", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasSet) {
-  SetCommandLineOption("test_int32", "700");
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("700", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) {
-  // This doesn't set the flag's value, but rather its default value.
-  // is_default is still true, but the 'default' value returned has changed!
-  SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT);
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("800", value);
-  EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default);
-
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) {
-  SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT);
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("900", value);
-}
-
-TEST(GetCommandLineOptionTest, NameDoesNotExist) {
-  string value("will not be changed");
-  const bool r = GetCommandLineOption("test_int3210", &value);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ("will not be changed", value);
-}
-
-TEST(GetCommandLineFlagInfoTest, FlagExists) {
-  CommandLineFlagInfo info;
-  bool r = GetCommandLineFlagInfo("test_int32", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("-1", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-
-  FLAGS_test_bool = true;
-  r = GetCommandLineFlagInfo("test_bool", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("true", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-
-  FLAGS_test_bool = false;
-  r = GetCommandLineFlagInfo("test_bool", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("false", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);  // value is same, but flag *was* modified
-}
-
-TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) {
-  CommandLineFlagInfo info;
-  // Set to some random values that GetCommandLineFlagInfo should not change
-  info.name = "name";
-  info.type = "type";
-  info.current_value = "curr";
-  info.default_value = "def";
-  info.filename = "/";
-  info.is_default = false;
-  bool r = GetCommandLineFlagInfo("test_int3210", &info);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ("name", info.name);
-  EXPECT_EQ("type", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("curr", info.current_value);
-  EXPECT_EQ("def", info.default_value);
-  EXPECT_EQ("/", info.filename);
-  EXPECT_EQ(false, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) {
-  CommandLineFlagInfo info;
-  info = GetCommandLineFlagInfoOrDie("test_int32");
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("-1", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-  info = GetCommandLineFlagInfoOrDie("test_bool");
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("false", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) {
-  FLAGS_test_int32 = 400;
-  CommandLineFlagInfo info;
-  info = GetCommandLineFlagInfoOrDie("test_int32");
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("400", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-  FLAGS_test_bool = true;
-  info = GetCommandLineFlagInfoOrDie("test_bool");
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("true", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagDoesNotExist) {
-  EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"),
-               ".*: flag test_int3210 does not exist");
-}
-
-
-// These are lightly tested because they're deprecated.  Basically,
-// the tests are meant to cover how existing users use these functions,
-// but not necessarily how new users could use them.
-TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) {
-  string s = CommandlineFlagsIntoString();
-  EXPECT_NE(string::npos, s.find("--test_bool="));
-}
-
-TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) {
-  FLAGS_test_int32 = 10;     // just to make the test more interesting
-  string filename(FLAGS_test_tmpdir + "/flagfile");
-  unlink(filename.c_str());  // just to be safe
-  const bool r = AppendFlagsIntoFile(filename, "not the real argv0");
-  EXPECT_EQ(true, r);
-
-  FILE* fp = fopen(filename.c_str(), "r");
-  EXPECT_TRUE(fp != NULL);
-  char line[8192];
-  fgets(line, sizeof(line)-1, fp);   // first line should be progname
-  EXPECT_STREQ("not the real argv0\n", line);
-
-  bool found_bool = false, found_int32 = false;
-  while (fgets(line, sizeof(line)-1, fp)) {
-    line[sizeof(line)-1] = '\0';    // just to be safe
-    if (strcmp(line, "--test_bool=false\n") == 0)
-      found_bool = true;
-    if (strcmp(line, "--test_int32=10\n") == 0)
-      found_int32 = true;
-  }
-  EXPECT_EQ(true, found_int32);
-  EXPECT_EQ(true, found_bool);
-  fclose(fp);
-}
-
-TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) {
-  FLAGS_test_int32 = -10;    // just to make the test more interesting
-  string filename(FLAGS_test_tmpdir + "/flagfile2");
-  unlink(filename.c_str());  // just to be safe
-  bool r = AppendFlagsIntoFile(filename, GetArgv0());
-  EXPECT_EQ(true, r);
-
-  FLAGS_test_int32 = -11;
-  r = ReadFromFlagsFile(filename, GetArgv0(), true);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ(-10, FLAGS_test_int32);
-}
-
-TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) {
-  FLAGS_test_int32 = -20;
-  string filename(FLAGS_test_tmpdir + "/flagfile3");
-  FILE* fp = fopen(filename.c_str(), "w");
-  EXPECT_TRUE(fp != NULL);
-  // Note the error in the bool assignment below...
-  fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0());
-  fclose(fp);
-
-  FLAGS_test_int32 = -22;
-  const bool r = ReadFromFlagsFile(filename, GetArgv0(), false);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ(-22, FLAGS_test_int32);   // the -21 from the flagsfile didn't take
-}
-
-TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) {
-  EXPECT_EQ("pre-set", FLAGS_test_tryfromenv);
-}
-
-// The following test case verifies that ParseCommandLineFlags() and
-// ParseCommandLineNonHelpFlags() uses the last definition of a flag
-// in case it's defined more than once.
-
-DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc");
-
-// Returns the definition of the --flagfile flag to be used in the tests.
-const char* GetFlagFileFlag() {
-  static const string flagfile_flag = string("--flagfile=")
-      + FLAGS_srcdir + "/src/gflags_unittest_flagfile";
-
-  return flagfile_flag.c_str();
-}
-
-// Parses and returns the --test_flag flag.
-// If with_help is true, calls ParseCommandLineFlags; otherwise calls
-// ParseCommandLineNonHelpFlags.
-int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) {
-  FlagSaver fs;  // Restores the flags before returning.
-
-  // Makes a copy of the input array s.t. it can be reused
-  // (ParseCommandLineFlags() will alter the array).
-  char** const argv_save = new char*[argc + 1];
-  char** argv = argv_save;
-  memcpy(argv, const_argv, sizeof(*argv)*(argc + 1));
-
-  if (with_help) {
-    ParseCommandLineFlags(&argc, &argv, true);
-  } else {
-    ParseCommandLineNonHelpFlags(&argc, &argv, true);
-  }
-
-  delete[] argv_save;
-  return FLAGS_test_flag;
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedTwiceOnCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=1",
-    "--test_flag=2",
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedTwiceInFlagFile) {
-  const char* argv[] = {
-    "my_test",
-    GetFlagFileFlag(),
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInCommandLineAndThenFlagFile) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=0",
-    GetFlagFileFlag(),
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInFlagFileAndThenCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    GetFlagFileFlag(),
-    "--test_flag=3",
-    NULL,
-  };
-
-  EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=0",
-    GetFlagFileFlag(),
-    "--test_flag=3",
-    NULL,
-  };
-
-  EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-static int Main(int argc, char **argv) {
-  // We need to call SetArgv before InitGoogle, so our "test" argv will
-  // win out over this executable's real argv.  That makes running this
-  // test with a real --help flag kinda annoying, unfortunately.
-  const char* test_argv[] = { "/test/argv/for/gflags_unittest",
-                              "argv 2", "3rd argv", "argv #4" };
-  SetArgv(GET_ARRAY_SIZE(test_argv), test_argv);
-
-  // The first arg is the usage message, also important for testing.
-  string usage_message = (string(GetArgv0()) +
-                          ": <useless flag> [...]\nDoes something useless.\n");
-
-  // We test setting tryfromenv manually, and making sure initgoogle still
-  // evaluates it.
-  FLAGS_tryfromenv = "test_tryfromenv";
-  setenv("FLAGS_test_tryfromenv", "pre-set", 1);
-
-  SetUsageMessage(usage_message.c_str());
-  ParseCommandLineFlags(&argc, &argv, true);
-
-  mkdir(FLAGS_test_tmpdir.c_str(), 0755);
-
-  return RUN_ALL_TESTS();
-}
-
-_END_GOOGLE_NAMESPACE_
-
-int main(int argc, char** argv) {
-  return GOOGLE_NAMESPACE::Main(argc, argv);
-}
diff --git a/gflags_unittest_main.cc b/gflags_unittest_main.cc
deleted file mode 100644 (file)
index 3ec0333..0000000
+++ /dev/null
@@ -1,1125 +0,0 @@
-// Copyright (c) 2006, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// ---
-// Author: Marius Eriksen
-//
-// For now, this unit test does not cover all features of
-// commandlineflags.cc
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>     // for unlink()
-#include <sys/stat.h>   // for mkdir()
-#include <math.h>       // for isinf() and isnan()
-#include <vector>
-#include <string>
-#include "google/gflags.h"
-
-using std::vector;
-using std::string;
-
-// Returns the number of elements in an array.  We don't use the safer
-// version in base/basictypes.h as commandlineflags is open-sourced.
-#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
-
-DECLARE_string(tryfromenv);   // in commandlineflags.cc
-
-DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files");
-DEFINE_string(srcdir, google::StringFromEnv("SRCDIR", "."),
-              "Source-dir root, needed to find gflags_unittest_flagfile");
-
-
-DEFINE_bool(test_bool, false, "tests bool-ness");
-DEFINE_int32(test_int32, -1, "");
-DEFINE_int64(test_int64, -2, "");
-DEFINE_uint64(test_uint64, 2, "");
-DEFINE_double(test_double, -1.0, "");
-DEFINE_string(test_string, "initial", "");
-
-//
-// The below ugliness gets some additional code coverage in the -helpxml
-// and -helpmatch test cases having to do with string lengths and formatting
-//
-DEFINE_bool(test_bool_with_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_quite_long_name,
-            false,
-            "extremely_extremely_extremely_extremely_extremely_extremely_extremely_extremely_long_meaning");
-
-DEFINE_string(test_str1, "initial", "");
-DEFINE_string(test_str2, "initial", "");
-DEFINE_string(test_str3, "initial", "");
-
-// This is used to test setting tryfromenv manually
-DEFINE_string(test_tryfromenv, "initial", "");
-
-// These are never used in this unittest, but can be used by
-// commandlineflags_unittest.sh when it needs to specify flags
-// that are legal for commandlineflags_unittest but don't need to
-// be a particular value.
-DEFINE_bool(unused_bool, true, "unused bool-ness");
-DEFINE_int32(unused_int32, -1001, "");
-DEFINE_int64(unused_int64, -2001, "");
-DEFINE_uint64(unused_uint64, 2000, "");
-DEFINE_double(unused_double, -1000.0, "");
-DEFINE_string(unused_string, "unused", "");
-
-_START_GOOGLE_NAMESPACE_
-
-// The following is some bare-bones testing infrastructure
-
-#define EXPECT_TRUE(cond)                               \
-  do {                                                  \
-    if (!(cond)) {                                      \
-      fprintf(stderr, "Check failed: %s\n", #cond);     \
-      exit(1);                                          \
-    }                                                   \
-  } while (0)
-
-#define EXPECT_FALSE(cond)  EXPECT_TRUE(!(cond))
-
-#define EXPECT_OP(op, val1, val2)                                       \
-  do {                                                                  \
-    if (!((val1) op (val2))) {                                          \
-      fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2);   \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-#define EXPECT_EQ(val1, val2)  EXPECT_OP(==, val1, val2)
-#define EXPECT_NE(val1, val2)  EXPECT_OP(!=, val1, val2)
-#define EXPECT_GT(val1, val2)  EXPECT_OP(>, val1, val2)
-#define EXPECT_LT(val1, val2)  EXPECT_OP(<, val1, val2)
-
-#define EXPECT_NAN(arg)                                         \
-  do {                                                          \
-    if (!isnan(arg)) {                                          \
-      fprintf(stderr, "Check failed: isnan(%s)\n", #arg);       \
-      exit(1);                                                  \
-    }                                                           \
-  } while (0)
-
-#define EXPECT_INF(arg)                                         \
-  do {                                                          \
-    if (!isinf(arg)) {                                          \
-      fprintf(stderr, "Check failed: isinf(%s)\n", #arg);       \
-      exit(1);                                                  \
-    }                                                           \
-  } while (0)
-
-#define EXPECT_DOUBLE_EQ(val1, val2)                                    \
-  do {                                                                  \
-    if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) {         \
-      fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2);        \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-#define EXPECT_STREQ(val1, val2)                                        \
-  do {                                                                  \
-    if (strcmp((val1), (val2)) != 0) {                                  \
-      fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2);   \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-static bool g_called_exit;
-static void CalledExit(int) { g_called_exit = true; }
-
-#define EXPECT_DEATH(fn, msg)                                           \
-  do {                                                                  \
-    g_called_exit = false;                                              \
-    extern void (*commandlineflags_exitfunc)(int);   /* in gflags.cc */ \
-    commandlineflags_exitfunc = &CalledExit;                            \
-    fn;                                                                 \
-    commandlineflags_exitfunc = &exit;    /* set back to its default */ \
-    if (!g_called_exit) {                                               \
-      fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn);      \
-      exit(1);                                                          \
-    }                                                                   \
-  } while (0)
-
-
-vector<void (*)()> g_testlist;  // the tests to run
-
-#define TEST(a, b)                                      \
-  struct Test_##a##_##b {                               \
-    Test_##a##_##b() { g_testlist.push_back(&Run); }    \
-    static void Run() { FlagSaver fs; RunTest(); }      \
-    static void RunTest();                              \
-  };                                                    \
-  static Test_##a##_##b g_test_##a##_##b;               \
-  void Test_##a##_##b::RunTest()
-
-
-static int RUN_ALL_TESTS() {
-  vector<void (*)()>::const_iterator it;
-  for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {
-    (*it)();
-  }
-  fprintf(stderr, "Passed %d tests\n\nPASS\n", (int)g_testlist.size());
-  return 0;
-}
-
-
-// Death tests for "help" options.
-//
-// The help system automatically calls exit(1) when you specify any of
-// the help-related flags ("-helpmatch", "-helpxml") so we can't test
-// those mainline.
-
-// Tests that "-helpmatch" causes the process to die.
-TEST(ReadFlagsFromStringDeathTest, HelpMatch) {
-  EXPECT_DEATH(ReadFlagsFromString("-helpmatch=base", GetArgv0(), true),
-               "");
-}
-
-
-// Tests that "-helpxml" causes the process to die.
-TEST(ReadFlagsFromStringDeathTest, HelpXml) {
-  EXPECT_DEATH(ReadFlagsFromString("-helpxml", GetArgv0(), true),
-               "");
-}
-
-
-// A subroutine needed for testing reading flags from a string.
-void TestFlagString(const string& flags,
-                    const string& expected_string,
-                    bool expected_bool,
-                    int32 expected_int32,
-                    double expected_double) {
-  EXPECT_TRUE(ReadFlagsFromString(flags,
-                                  GetArgv0(),
-                                  // errors are fatal
-                                  true));
-
-  EXPECT_EQ(expected_string, FLAGS_test_string);
-  EXPECT_EQ(expected_bool, FLAGS_test_bool);
-  EXPECT_EQ(expected_int32, FLAGS_test_int32);
-  EXPECT_DOUBLE_EQ(expected_double, FLAGS_test_double);
-}
-
-
-// Tests reading flags from a string.
-TEST(FlagFileTest, ReadFlagsFromString) {
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "-test_double=0.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      0.0);
-
-  TestFlagString(
-      // Flag string
-      "# let's make sure it can update values\n"
-      "-test_string=initial\n"
-      "-test_bool=false\n"
-      "-test_int32=123\n"
-      "-test_double=123.0\n",
-      // Expected values
-      "initial",
-      false,
-      123,
-      123.0);
-}
-
-// Tests the filename part of the flagfile
-TEST(FlagFileTest, FilenamesOurfileLast) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "not_our_filename\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "gflags_unittest\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      false,
-      -1,
-      1000.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileFirst) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "gflags_unittest\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "not_our_filename\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileGlob) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "*flags*\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "flags\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-TEST(FlagFileTest, FilenamesOurfileInBigList) {
-  FLAGS_test_string = "initial";
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_double = -1.0;
-  TestFlagString(
-      // Flag string
-      "-test_string=continued\n"
-      "# some comments are in order\n"
-      "# some\n"
-      "  # comments\n"
-      "#are\n"
-      "                  #trickier\n"
-      "# than others\n"
-      "*first* *flags* *third*\n"
-      "-test_bool=true\n"
-      "     -test_int32=1\n"
-      "flags\n"
-      "-test_double=1000.0\n",
-      // Expected values
-      "continued",
-      true,
-      1,
-      -1.0);
-}
-
-// Tests that a failed flag-from-string read keeps flags at default values
-TEST(FlagFileTest, FailReadFlagsFromString) {
-  FLAGS_test_int32 = 119;
-  string flags("# let's make sure it can update values\n"
-               "-test_string=non_initial\n"
-               "-test_bool=false\n"
-               "-test_int32=123\n"
-               "-test_double=illegal\n");
-
-  EXPECT_FALSE(ReadFlagsFromString(flags,
-                                   GetArgv0(),
-                                   // errors are fatal
-                                   false));
-
-  EXPECT_EQ(119, FLAGS_test_int32);
-  EXPECT_EQ("initial", FLAGS_test_string);
-}
-
-// Tests that flags can be set to ordinary values.
-TEST(SetFlagValueTest, OrdinaryValues) {
-  EXPECT_EQ("initial", FLAGS_test_str1);
-
-  SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);  // set; was default
-
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);  // already set once
-
-  FLAGS_test_str1 = "initial";
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("initial", FLAGS_test_str1);  // still already set before
-
-  SetCommandLineOptionWithMode("test_str1", "third", SET_FLAGS_VALUE);
-  EXPECT_EQ("third", FLAGS_test_str1);  // changed value
-
-  SetCommandLineOptionWithMode("test_str1", "fourth", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str1);
-  // value not changed (already set before)
-
-  EXPECT_EQ("initial", FLAGS_test_str2);
-
-  SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str2);  // changed (was default)
-
-  FLAGS_test_str2 = "extra";
-  EXPECT_EQ("extra", FLAGS_test_str2);
-
-  FLAGS_test_str2 = "second";
-  SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str2);  // still changed (was equal to default)
-
-  SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("fourth", FLAGS_test_str2);  // changed (was default)
-
-  EXPECT_EQ("initial", FLAGS_test_str3);
-
-  SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str3);  // changed
-
-  FLAGS_test_str3 = "third";
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str3);  // not changed (was set)
-
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("third", FLAGS_test_str3);  // not changed (was set)
-
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAGS_VALUE);
-  EXPECT_EQ("fourth", FLAGS_test_str3);  // changed value
-}
-
-
-// Tests that flags can be set to exceptional values.
-TEST(SetFlagValueTest, ExceptionalValues) {
-  EXPECT_EQ("test_double set to inf\n",
-            SetCommandLineOption("test_double", "inf"));
-  EXPECT_INF(FLAGS_test_double);
-
-  EXPECT_EQ("test_double set to inf\n",
-            SetCommandLineOption("test_double", "INF"));
-  EXPECT_INF(FLAGS_test_double);
-
-  // set some bad values
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", "0.1xxx"));
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", " "));
-  EXPECT_EQ("",
-            SetCommandLineOption("test_double", ""));
-  EXPECT_EQ("test_double set to -inf\n",
-            SetCommandLineOption("test_double", "-inf"));
-  EXPECT_INF(FLAGS_test_double);
-  EXPECT_GT(0, FLAGS_test_double);
-
-  EXPECT_EQ("test_double set to nan\n",
-            SetCommandLineOption("test_double", "NaN"));
-  EXPECT_NAN(FLAGS_test_double);
-}
-
-// Tests that integer flags can be specified in many ways
-TEST(SetFlagValueTest, DifferentRadices) {
-  EXPECT_EQ("test_int32 set to 12\n",
-            SetCommandLineOption("test_int32", "12"));
-
-  EXPECT_EQ("test_int32 set to 16\n",
-            SetCommandLineOption("test_int32", "0x10"));
-
-  EXPECT_EQ("test_int32 set to 34\n",
-            SetCommandLineOption("test_int32", "0X22"));
-
-  // Leading 0 is *not* octal; it's still decimal
-  EXPECT_EQ("test_int32 set to 10\n",
-            SetCommandLineOption("test_int32", "010"));
-}
-
-// Tests what happens when you try to set a flag to an illegal value
-TEST(SetFlagValueTest, IllegalValues) {
-  FLAGS_test_bool = true;
-  FLAGS_test_int32 = 119;
-  FLAGS_test_int64 = 1191;
-  FLAGS_test_uint64 = 11911;
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_bool", "12"));
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_int32", "7000000000000"));
-
-  // TODO(csilvers): uncomment this when we disallow negative numbers for uint64
-#if 0
-  EXPECT_EQ("",
-            SetCommandLineOption("test_uint64", "-1"));
-#endif
-
-  EXPECT_EQ("",
-            SetCommandLineOption("test_int64", "not a number!"));
-
-  // Test the empty string with each type of input
-  EXPECT_EQ("", SetCommandLineOption("test_bool", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_int32", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_int64", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_uint64", ""));
-  EXPECT_EQ("", SetCommandLineOption("test_double", ""));
-  EXPECT_EQ("test_string set to \n", SetCommandLineOption("test_string", ""));
-
-  EXPECT_EQ(true, FLAGS_test_bool);
-  EXPECT_EQ(119, FLAGS_test_int32);
-  EXPECT_EQ(1191, FLAGS_test_int64);
-  EXPECT_EQ(11911, FLAGS_test_uint64);
-}
-
-
-// Tests that the FooFromEnv does the right thing
-TEST(FromEnvTest, LegalValues) {
-  setenv("BOOL_VAL1", "true", 1);
-  setenv("BOOL_VAL2", "false", 1);
-  setenv("BOOL_VAL3", "1", 1);
-  setenv("BOOL_VAL4", "F", 1);
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL1", false));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL2", true));
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL3", false));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL4", true));
-  EXPECT_EQ(true, BoolFromEnv("BOOL_VAL_UNKNOWN", true));
-  EXPECT_EQ(false, BoolFromEnv("BOOL_VAL_UNKNOWN", false));
-
-  setenv("INT_VAL1", "1", 1);
-  setenv("INT_VAL2", "-1", 1);
-  EXPECT_EQ(1, Int32FromEnv("INT_VAL1", 10));
-  EXPECT_EQ(-1, Int32FromEnv("INT_VAL2", 10));
-  EXPECT_EQ(10, Int32FromEnv("INT_VAL_UNKNOWN", 10));
-
-  setenv("INT_VAL3", "1099511627776", 1);
-  EXPECT_EQ(1, Int64FromEnv("INT_VAL1", 20));
-  EXPECT_EQ(-1, Int64FromEnv("INT_VAL2", 20));
-  EXPECT_EQ(1099511627776LL, Int64FromEnv("INT_VAL3", 20));
-  EXPECT_EQ(20, Int64FromEnv("INT_VAL_UNKNOWN", 20));
-
-  EXPECT_EQ(1, Uint64FromEnv("INT_VAL1", 30));
-  EXPECT_EQ(1099511627776ULL, Uint64FromEnv("INT_VAL3", 30));
-  EXPECT_EQ(30, Uint64FromEnv("INT_VAL_UNKNOWN", 30));
-
-  // I pick values here that can be easily represented exactly in floating-point
-  setenv("DOUBLE_VAL1", "0.0", 1);
-  setenv("DOUBLE_VAL2", "1.0", 1);
-  setenv("DOUBLE_VAL3", "-1.0", 1);
-  EXPECT_EQ(0.0, DoubleFromEnv("DOUBLE_VAL1", 40.0));
-  EXPECT_EQ(1.0, DoubleFromEnv("DOUBLE_VAL2", 40.0));
-  EXPECT_EQ(-1.0, DoubleFromEnv("DOUBLE_VAL3", 40.0));
-  EXPECT_EQ(40.0, DoubleFromEnv("DOUBLE_VAL_UNKNOWN", 40.0));
-
-  setenv("STRING_VAL1", "", 1);
-  setenv("STRING_VAL2", "my happy string!", 1);
-  EXPECT_STREQ("", StringFromEnv("STRING_VAL1", "unknown"));
-  EXPECT_STREQ("my happy string!", StringFromEnv("STRING_VAL2", "unknown"));
-  EXPECT_STREQ("unknown", StringFromEnv("STRING_VAL_UNKNOWN", "unknown"));
-}
-
-// Tests that the FooFromEnv dies on parse-error
-TEST(FromEnvTest, IllegalValues) {
-  setenv("BOOL_BAD1", "so true!",1 );
-  setenv("BOOL_BAD2", "", 1);
-  EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable");
-  EXPECT_DEATH(BoolFromEnv("BOOL_BAD2", true), "error parsing env variable");
-
-  setenv("INT_BAD1", "one", 1);
-  setenv("INT_BAD2", "100000000000000000", 1);
-  setenv("INT_BAD3", "0xx10", 1);
-  setenv("INT_BAD4", "", 1);
-  EXPECT_DEATH(Int32FromEnv("INT_BAD1", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD2", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD3", 10), "error parsing env variable");
-  EXPECT_DEATH(Int32FromEnv("INT_BAD4", 10), "error parsing env variable");
-
-  setenv("BIGINT_BAD1", "18446744073709551616000", 1);
-  EXPECT_DEATH(Int64FromEnv("INT_BAD1", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("INT_BAD3", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("INT_BAD4", 20), "error parsing env variable");
-  EXPECT_DEATH(Int64FromEnv("BIGINT_BAD1", 200), "error parsing env variable");
-
-  setenv("BIGINT_BAD2", "-1", 1);
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD1", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD3", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("INT_BAD4", 30), "error parsing env variable");
-  EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD1", 30), "error parsing env variable");
-  // TODO(csilvers): uncomment this when we disallow negative numbers for uint64
-#if 0
-  EXPECT_DEATH(Uint64FromEnv("BIGINT_BAD2", 30), "error parsing env variable");
-#endif
-
-  setenv("DOUBLE_BAD1", "0.0.0", 1);
-  setenv("DOUBLE_BAD2", "", 1);
-  EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD1", 40.0), "error parsing env variable");
-  EXPECT_DEATH(DoubleFromEnv("DOUBLE_BAD2", 40.0), "error parsing env variable");
-}
-
-// Tests that FlagSaver can save the states of string flags.
-TEST(FlagSaverTest, CanSaveStringFlagStates) {
-  // 1. Initializes the flags.
-
-  // State of flag test_str1:
-  //   default value - "initial"
-  //   current value - "initial"
-  //   not set       - true
-
-  SetCommandLineOptionWithMode("test_str2", "second", SET_FLAGS_VALUE);
-  // State of flag test_str2:
-  //   default value - "initial"
-  //   current value - "second"
-  //   not set       - false
-
-  SetCommandLineOptionWithMode("test_str3", "second", SET_FLAGS_DEFAULT);
-  // State of flag test_str3:
-  //   default value - "second"
-  //   current value - "second"
-  //   not set       - true
-
-  // 2. Saves the flag states.
-
-  {
-    FlagSaver fs;
-
-    // 3. Modifies the flag states.
-
-    SetCommandLineOptionWithMode("test_str1", "second", SET_FLAGS_VALUE);
-    EXPECT_EQ("second", FLAGS_test_str1);
-    // State of flag test_str1:
-    //   default value - "second"
-    //   current value - "second"
-    //   not set       - true
-
-    SetCommandLineOptionWithMode("test_str2", "third", SET_FLAGS_DEFAULT);
-    EXPECT_EQ("second", FLAGS_test_str2);
-    // State of flag test_str2:
-    //   default value - "third"
-    //   current value - "second"
-    //   not set       - false
-
-    SetCommandLineOptionWithMode("test_str3", "third", SET_FLAGS_VALUE);
-    EXPECT_EQ("third", FLAGS_test_str3);
-    // State of flag test_str1:
-    //   default value - "second"
-    //   current value - "third"
-    //   not set       - false
-
-    // 4. Restores the flag states.
-  }
-
-  // 5. Verifies that the states were restored.
-
-  // Verifies that the value of test_str1 was restored.
-  EXPECT_EQ("initial", FLAGS_test_str1);
-  // Verifies that the "not set" attribute of test_str1 was restored to true.
-  SetCommandLineOptionWithMode("test_str1", "second", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str1);
-
-  // Verifies that the value of test_str2 was restored.
-  EXPECT_EQ("second", FLAGS_test_str2);
-  // Verifies that the "not set" attribute of test_str2 was restored to false.
-  SetCommandLineOptionWithMode("test_str2", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("second", FLAGS_test_str2);
-
-  // Verifies that the value of test_str3 was restored.
-  EXPECT_EQ("second", FLAGS_test_str3);
-  // Verifies that the "not set" attribute of test_str3 was restored to true.
-  SetCommandLineOptionWithMode("test_str3", "fourth", SET_FLAG_IF_DEFAULT);
-  EXPECT_EQ("fourth", FLAGS_test_str3);
-}
-
-
-// Tests that FlagSaver can save the values of various-typed flags.
-TEST(FlagSaverTest, CanSaveVariousTypedFlagValues) {
-  // Initializes the flags.
-  FLAGS_test_bool = false;
-  FLAGS_test_int32 = -1;
-  FLAGS_test_int64 = -2;
-  FLAGS_test_uint64 = 3;
-  FLAGS_test_double = 4.0;
-  FLAGS_test_string = "good";
-
-  // Saves the flag states.
-  {
-    FlagSaver fs;
-
-    // Modifies the flags.
-    FLAGS_test_bool = true;
-    FLAGS_test_int32 = -5;
-    FLAGS_test_int64 = -6;
-    FLAGS_test_uint64 = 7;
-    FLAGS_test_double = 8.0;
-    FLAGS_test_string = "bad";
-
-    // Restores the flag states.
-  }
-
-  // Verifies the flag values were restored.
-  EXPECT_FALSE(FLAGS_test_bool);
-  EXPECT_EQ(-1, FLAGS_test_int32);
-  EXPECT_EQ(-2, FLAGS_test_int64);
-  EXPECT_EQ(3, FLAGS_test_uint64);
-  EXPECT_DOUBLE_EQ(4.0, FLAGS_test_double);
-  EXPECT_EQ("good", FLAGS_test_string);
-}
-
-TEST(GetAllFlagsTest, BaseTest) {
-  vector<CommandLineFlagInfo> flags;
-  GetAllFlags(&flags);
-  bool found_test_bool = false;
-  vector<CommandLineFlagInfo>::const_iterator i;
-  for (i = flags.begin(); i != flags.end(); ++i) {
-    if (i->name == "test_bool") {
-      found_test_bool = true;
-      EXPECT_EQ(i->type, "bool");
-      EXPECT_EQ(i->default_value, "false");
-      break;
-    }
-  }
-  EXPECT_EQ(true, found_test_bool);
-}
-
-TEST(ShowUsageWithFlagsTest, BaseTest) {
-  // TODO(csilvers): test this by allowing output other than to stdout.
-  // Not urgent since this functionality is tested via
-  // gflags_unittest.sh, though only through use of --help.
-}
-
-TEST(ShowUsageWithFlagsRestrictTest, BaseTest) {
-  // TODO(csilvers): test this by allowing output other than to stdout.
-  // Not urgent since this functionality is tested via
-  // gflags_unittest.sh, though only through use of --helpmatch.
-}
-
-// Note: all these argv-based tests depend on SetArgv being called
-// before InitGoogle() in main(), below.
-TEST(GetArgvsTest, BaseTest) {
-  vector<string> argvs = GetArgvs();
-  EXPECT_EQ(4, argvs.size());
-  EXPECT_EQ("/test/argv/for/gflags_unittest", argvs[0]);
-  EXPECT_EQ("argv 2", argvs[1]);
-  EXPECT_EQ("3rd argv", argvs[2]);
-  EXPECT_EQ("argv #4", argvs[3]);
-}
-
-TEST(GetArgvTest, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest "
-               "argv 2 3rd argv argv #4", GetArgv());
-}
-
-TEST(GetArgv0Test, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest", GetArgv0());
-}
-
-TEST(GetArgvSumTest, BaseTest) {
-  // This number is just the sum of the ASCII values of all the chars
-  // in GetArgv().
-  EXPECT_EQ(4904, GetArgvSum());
-}
-
-TEST(ProgramInvocationNameTest, BaseTest) {
-  EXPECT_STREQ("/test/argv/for/gflags_unittest",
-               ProgramInvocationName());
-}
-
-TEST(ProgramInvocationShortNameTest, BaseTest) {
-  EXPECT_STREQ("gflags_unittest", ProgramInvocationShortName());
-}
-
-TEST(ProgramUsageTest, BaseTest) { // Depends on 1st arg to InitGoogle in main()
-  EXPECT_STREQ("/test/argv/for/gflags_unittest: "
-               "<useless flag> [...]\nDoes something useless.\n",
-               ProgramUsage());
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndIsDefault) {
-  string value("will be changed");
-  bool r = GetCommandLineOption("test_bool", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("false", value);
-
-  r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("-1", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasAssigned) {
-  FLAGS_test_int32 = 400;
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("400", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasSet) {
-  SetCommandLineOption("test_int32", "700");
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("700", value);
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasNotSet) {
-  // This doesn't set the flag's value, but rather its default value.
-  // is_default is still true, but the 'default' value returned has changed!
-  SetCommandLineOptionWithMode("test_int32", "800", SET_FLAGS_DEFAULT);
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("800", value);
-  EXPECT_EQ(true, GetCommandLineFlagInfoOrDie("test_int32").is_default);
-
-}
-
-TEST(GetCommandLineOptionTest, NameExistsAndWasConditionallySet) {
-  SetCommandLineOptionWithMode("test_int32", "900", SET_FLAG_IF_DEFAULT);
-  string value("will be changed");
-  const bool r = GetCommandLineOption("test_int32", &value);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("900", value);
-}
-
-TEST(GetCommandLineOptionTest, NameDoesNotExist) {
-  string value("will not be changed");
-  const bool r = GetCommandLineOption("test_int3210", &value);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ("will not be changed", value);
-}
-
-TEST(GetCommandLineFlagInfoTest, FlagExists) {
-  CommandLineFlagInfo info;
-  bool r = GetCommandLineFlagInfo("test_int32", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("-1", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-
-  FLAGS_test_bool = true;
-  r = GetCommandLineFlagInfo("test_bool", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("true", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-
-  FLAGS_test_bool = false;
-  r = GetCommandLineFlagInfo("test_bool", &info);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("false", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);  // value is same, but flag *was* modified
-}
-
-TEST(GetCommandLineFlagInfoTest, FlagDoesNotExist) {
-  CommandLineFlagInfo info;
-  // Set to some random values that GetCommandLineFlagInfo should not change
-  info.name = "name";
-  info.type = "type";
-  info.current_value = "curr";
-  info.default_value = "def";
-  info.filename = "/";
-  info.is_default = false;
-  bool r = GetCommandLineFlagInfo("test_int3210", &info);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ("name", info.name);
-  EXPECT_EQ("type", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("curr", info.current_value);
-  EXPECT_EQ("def", info.default_value);
-  EXPECT_EQ("/", info.filename);
-  EXPECT_EQ(false, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndIsDefault) {
-  CommandLineFlagInfo info;
-  info = GetCommandLineFlagInfoOrDie("test_int32");
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("-1", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-  info = GetCommandLineFlagInfoOrDie("test_bool");
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("false", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(true, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) {
-  FLAGS_test_int32 = 400;
-  CommandLineFlagInfo info;
-  info = GetCommandLineFlagInfoOrDie("test_int32");
-  EXPECT_EQ("test_int32", info.name);
-  EXPECT_EQ("int32", info.type);
-  EXPECT_EQ("", info.description);
-  EXPECT_EQ("400", info.current_value);
-  EXPECT_EQ("-1", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-  FLAGS_test_bool = true;
-  info = GetCommandLineFlagInfoOrDie("test_bool");
-  EXPECT_EQ("test_bool", info.name);
-  EXPECT_EQ("bool", info.type);
-  EXPECT_EQ("tests bool-ness", info.description);
-  EXPECT_EQ("true", info.current_value);
-  EXPECT_EQ("false", info.default_value);
-  EXPECT_EQ(false, info.is_default);
-}
-
-TEST(GetCommandLineFlagInfoOrDieTest, FlagDoesNotExist) {
-  EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"),
-               ".*: flag test_int3210 does not exist");
-}
-
-
-// These are lightly tested because they're deprecated.  Basically,
-// the tests are meant to cover how existing users use these functions,
-// but not necessarily how new users could use them.
-TEST(DeprecatedFunctionsTest, CommandlineFlagsIntoString) {
-  string s = CommandlineFlagsIntoString();
-  EXPECT_NE(string::npos, s.find("--test_bool="));
-}
-
-TEST(DeprecatedFunctionsTest, AppendFlagsIntoFile) {
-  FLAGS_test_int32 = 10;     // just to make the test more interesting
-  string filename(FLAGS_test_tmpdir + "/flagfile");
-  unlink(filename.c_str());  // just to be safe
-  const bool r = AppendFlagsIntoFile(filename, "not the real argv0");
-  EXPECT_EQ(true, r);
-
-  FILE* fp = fopen(filename.c_str(), "r");
-  EXPECT_TRUE(fp != NULL);
-  char line[8192];
-  fgets(line, sizeof(line)-1, fp);   // first line should be progname
-  EXPECT_STREQ("not the real argv0\n", line);
-
-  bool found_bool = false, found_int32 = false;
-  while (fgets(line, sizeof(line)-1, fp)) {
-    line[sizeof(line)-1] = '\0';    // just to be safe
-    if (strcmp(line, "--test_bool=false\n") == 0)
-      found_bool = true;
-    if (strcmp(line, "--test_int32=10\n") == 0)
-      found_int32 = true;
-  }
-  EXPECT_EQ(true, found_int32);
-  EXPECT_EQ(true, found_bool);
-  fclose(fp);
-}
-
-TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) {
-  FLAGS_test_int32 = -10;    // just to make the test more interesting
-  string filename(FLAGS_test_tmpdir + "/flagfile2");
-  unlink(filename.c_str());  // just to be safe
-  bool r = AppendFlagsIntoFile(filename, GetArgv0());
-  EXPECT_EQ(true, r);
-
-  FLAGS_test_int32 = -11;
-  r = ReadFromFlagsFile(filename, GetArgv0(), true);
-  EXPECT_EQ(true, r);
-  EXPECT_EQ(-10, FLAGS_test_int32);
-}
-
-TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) {
-  FLAGS_test_int32 = -20;
-  string filename(FLAGS_test_tmpdir + "/flagfile3");
-  FILE* fp = fopen(filename.c_str(), "w");
-  EXPECT_TRUE(fp != NULL);
-  // Note the error in the bool assignment below...
-  fprintf(fp, "%s\n--test_int32=-21\n--test_bool=not_a_bool!\n", GetArgv0());
-  fclose(fp);
-
-  FLAGS_test_int32 = -22;
-  const bool r = ReadFromFlagsFile(filename, GetArgv0(), false);
-  EXPECT_EQ(false, r);
-  EXPECT_EQ(-22, FLAGS_test_int32);   // the -21 from the flagsfile didn't take
-}
-
-TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) {
-  EXPECT_EQ("pre-set", FLAGS_test_tryfromenv);
-}
-
-// The following test case verifies that ParseCommandLineFlags() and
-// ParseCommandLineNonHelpFlags() uses the last definition of a flag
-// in case it's defined more than once.
-
-DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc");
-
-// Returns the definition of the --flagfile flag to be used in the tests.
-const char* GetFlagFileFlag() {
-  static const string flagfile_flag = string("--flagfile=")
-      + FLAGS_srcdir + "/src/gflags_unittest_flagfile";
-
-  return flagfile_flag.c_str();
-}
-
-// Parses and returns the --test_flag flag.
-// If with_help is true, calls ParseCommandLineFlags; otherwise calls
-// ParseCommandLineNonHelpFlags.
-int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) {
-  FlagSaver fs;  // Restores the flags before returning.
-
-  // Makes a copy of the input array s.t. it can be reused
-  // (ParseCommandLineFlags() will alter the array).
-  char** const argv_save = new char*[argc + 1];
-  char** argv = argv_save;
-  memcpy(argv, const_argv, sizeof(*argv)*(argc + 1));
-
-  if (with_help) {
-    ParseCommandLineFlags(&argc, &argv, true);
-  } else {
-    ParseCommandLineNonHelpFlags(&argc, &argv, true);
-  }
-
-  delete[] argv_save;
-  return FLAGS_test_flag;
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedTwiceOnCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=1",
-    "--test_flag=2",
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedTwiceInFlagFile) {
-  const char* argv[] = {
-    "my_test",
-    GetFlagFileFlag(),
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInCommandLineAndThenFlagFile) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=0",
-    GetFlagFileFlag(),
-    NULL,
-  };
-
-  EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInFlagFileAndThenCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    GetFlagFileFlag(),
-    "--test_flag=3",
-    NULL,
-  };
-
-  EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
-     WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) {
-  const char* argv[] = {
-    "my_test",
-    "--test_flag=0",
-    GetFlagFileFlag(),
-    "--test_flag=3",
-    NULL,
-  };
-
-  EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
-  EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
-}
-
-static int Main(int argc, char **argv) {
-  // We need to call SetArgv before InitGoogle, so our "test" argv will
-  // win out over this executable's real argv.  That makes running this
-  // test with a real --help flag kinda annoying, unfortunately.
-  const char* test_argv[] = { "/test/argv/for/gflags_unittest",
-                              "argv 2", "3rd argv", "argv #4" };
-  SetArgv(GET_ARRAY_SIZE(test_argv), test_argv);
-
-  // The first arg is the usage message, also important for testing.
-  string usage_message = (string(GetArgv0()) +
-                          ": <useless flag> [...]\nDoes something useless.\n");
-
-  // We test setting tryfromenv manually, and making sure initgoogle still
-  // evaluates it.
-  FLAGS_tryfromenv = "test_tryfromenv";
-  setenv("FLAGS_test_tryfromenv", "pre-set", 1);
-
-  SetUsageMessage(usage_message.c_str());
-  ParseCommandLineFlags(&argc, &argv, true);
-
-  mkdir(FLAGS_test_tmpdir.c_str(), 0755);
-
-  return RUN_ALL_TESTS();
-}
-
-_END_GOOGLE_NAMESPACE_
-
-int main(int argc, char** argv) {
-  return GOOGLE_NAMESPACE::Main(argc, argv);
-}
index 9fd9e03..f473dfd 100644 (file)
@@ -1,3 +1,9 @@
+google-gflags (1.0rc2-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Google Inc. <opensource@google.com>  Tue, 18 Sep 2008 12:58:05 -0700
+
 google-gflags (1.0rc1-1) unstable; urgency=low
 
   * New upstream release.
index ae5f1e2..b50188b 100644 (file)
@@ -7,7 +7,7 @@ Summary: A commandline flags library that allows for distributed flags
 Version: %VERSION
 Release: %rel
 Group: Development/Libraries
-URL: http://code.google.com/p/gflags
+URL: http://code.google.com/p/google-gflags
 License: BSD
 Vendor: Google
 Packager: Google Inc. <opensource@google.com>
index 1661440..f77f5f4 100755 (executable)
@@ -243,14 +243,12 @@ class FlagsUnitTest(unittest.TestCase):
     # Test integer argument passing
     argv = ('./program', '--x', '0x12345')
     argv = FLAGS(argv)
-    # 0x12345 == 74565
-    self.assertEquals(FLAGS.x, 74565)
+    self.assertEquals(FLAGS.x, 0x12345)
     self.assertEquals(type(FLAGS.x), int)
 
-    argv = ('./program', '--x', '0x123456789A')
+    argv = ('./program', '--x', '0x1234567890ABCDEF1234567890ABCDEF')
     argv = FLAGS(argv)
-    # 0x123456789A == 78187493530L
-    self.assertEquals(FLAGS.x, 78187493530L)
+    self.assertEquals(FLAGS.x, 0x1234567890ABCDEF1234567890ABCDEF)
     self.assertEquals(type(FLAGS.x), long)
 
     # Treat 0-prefixed parameters as base-10, not base-8
index 893d585..fb946ab 100644 (file)
@@ -210,6 +210,7 @@ typedef bool (*ValidateFnProto)();
 //    given type, and back.  Thread-compatible.
 // --------------------------------------------------------------------
 
+class CommandLineFlag;
 class FlagValue {
  public:
   FlagValue(void* valbuf, const char* type);
@@ -223,7 +224,7 @@ class FlagValue {
   friend class GOOGLE_NAMESPACE::FlagSaverImpl;  // calls New()
   friend class FlagRegistry;     // checks value_buffer_ for flags_by_ptr_ map
   template <typename T> friend T GetFromEnv(const char*, const char*, T);
-  friend bool TryParseLocked(const class CommandLineFlag*, FlagValue*,
+  friend bool TryParseLocked(const CommandLineFlag*, FlagValue*,
                              const char*, string*);  // for New(), CopyFrom()
 
   enum ValueType {FV_BOOL, FV_INT32, FV_INT64, FV_UINT64, FV_DOUBLE, FV_STRING};
index 12a989a..a31678a 100644 (file)
@@ -494,7 +494,7 @@ extern bool FlagsTypeWarn(const char *name);
 // try to avoid crashes in that case, we use a char buffer to store
 // the string, which we can static-initialize, and then placement-new
 // into it later.  It's not perfect, but the best we can do.
-#define DECLARE_string(name)  namespace fLS { extern string& FLAGS_##name; } \
+#define DECLARE_string(name)  namespace fLS { extern std::string& FLAGS_##name; } \
                               using fLS::FLAGS_##name
 
 // We need to define a var named FLAGS_no##name so people don't define
index cc75b2f..a539f30 100644 (file)
@@ -202,7 +202,7 @@ struct NotableFlags {
 static void PrintFlagCompletionInfo(void) {
   string cursor_word = FLAGS_tab_completion_word;
   string canonical_token;
-  CompletionOptions options;
+  CompletionOptions options = { };
   CanonicalizeCursorWordAndSearchOptions(
       cursor_word,
       &canonical_token,
index e69cbf4..521e3ff 100644 (file)
@@ -201,6 +201,7 @@ static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) {
           "<name>" + XMLText(flag.name) + "</name>" +
           "<meaning>" + XMLText(flag.description) + "</meaning>" +
           "<default>" + XMLText(flag.default_value) + "</default>" +
+          "<current>" + XMLText(flag.current_value) + "</current>" +
           "<type>" + XMLText(flag.type) + "</type>" +
           string("</flag>"));
 }
@@ -234,9 +235,16 @@ static bool FileMatchesSubstring(const string& filename,
   for (vector<string>::const_iterator target = substrings.begin();
        target != substrings.end();
        ++target) {
-    if (strstr(filename.c_str(), target->c_str()) != NULL) {
+    if (strstr(filename.c_str(), target->c_str()) != NULL)
+      return true;
+    // If the substring starts with a '/', that means that we want
+    // the string to be at the beginning of a directory component.
+    // That should match the first directory component as well, so
+    // we allow '/foo' to match a filename of 'foo'.
+    if (!target->empty() && (*target)[0] == '/' &&
+        strncmp(filename.c_str(), target->c_str() + 1,
+                strlen(target->c_str() + 1)) == 0)
       return true;
-    }
   }
   return false;
 }
index 079d5ec..19e6a8f 100644 (file)
@@ -31,7 +31,7 @@
 // Author: Marius Eriksen
 //
 // For now, this unit test does not cover all features of
-// commandlineflags.cc
+// gflags.cc
 
 #include "config.h"
 #include <stdio.h>
@@ -51,11 +51,13 @@ void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions;
 
 using std::vector;
 using std::string;
+using GOOGLE_NAMESPACE::int32;
+using GOOGLE_NAMESPACE::FlagRegisterer;
 
 // Returns the number of elements in an array.
 #define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
 
-DECLARE_string(tryfromenv);   // in commandlineflags.cc
+DECLARE_string(tryfromenv);   // in gflags.cc
 
 DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files");
 DEFINE_string(srcdir, GOOGLE_NAMESPACE::StringFromEnv("SRCDIR", "."),
@@ -111,8 +113,8 @@ static string ChangeableString() {
 DEFINE_string(changeable_string_var, ChangeableString(), "");
 
 // These are never used in this unittest, but can be used by
-// commandlineflags_unittest.sh when it needs to specify flags
-// that are legal for commandlineflags_unittest but don't need to
+// gflags_unittest.sh when it needs to specify flags
+// that are legal for gflags_unittest but don't need to
 // be a particular value.
 DEFINE_bool(unused_bool, true, "unused bool-ness");
 DEFINE_int32(unused_int32, -1001, "");
@@ -129,6 +131,31 @@ static bool AlwaysFail(const char* flag, bool value) { return value == false; }
 DEFINE_bool(always_fail, false, "will fail to validate when you set it");
 static const bool dummy = GOOGLE_NAMESPACE::RegisterFlagValidator(&FLAGS_always_fail, AlwaysFail);
 
+// This is a psuedo-flag -- we want to register a flag with a filename
+// at the top level, but there is no way to do this except by faking
+// the filename.
+namespace fLI {
+  static const int32 FLAGS_nonotldflag1 = 12;
+  int32 FLAGS_tldflag1 = FLAGS_nonotldflag1;
+  int32 FLAGS_notldflag1 = FLAGS_nonotldflag1;
+  static FlagRegisterer o_tldflag1(
+    "tldflag1", "int32",
+    "should show up in --helpshort", "gflags_unittest.cc",
+    &FLAGS_tldflag1, &FLAGS_notldflag1);
+}
+using fLI::FLAGS_tldflag1;
+
+namespace fLI {
+  static const int32 FLAGS_nonotldflag2 = 23;
+  int32 FLAGS_tldflag2 = FLAGS_nonotldflag2;
+  int32 FLAGS_notldflag2 = FLAGS_nonotldflag2;
+  static FlagRegisterer o_tldflag2(
+    "tldflag2", "int32",
+    "should show up in --helpshort", "gflags_unittest.",
+    &FLAGS_tldflag2, &FLAGS_notldflag2);
+}
+using fLI::FLAGS_tldflag2;
+
 _START_GOOGLE_NAMESPACE_
 
 // The following is some bare-bones testing infrastructure
@@ -674,7 +701,7 @@ TEST(FromEnvTest, LegalValues) {
 }
 
 // Tests that the FooFromEnv dies on parse-error
-TEST(FromEnvTest, IllegalValues) {
+TEST(FromEnvDeathTest, IllegalValues) {
   setenv("BOOL_BAD1", "so true!",1 );
   setenv("BOOL_BAD2", "", 1);
   EXPECT_DEATH(BoolFromEnv("BOOL_BAD1", false), "error parsing env variable");
@@ -1039,7 +1066,7 @@ TEST(GetCommandLineFlagInfoOrDieTest, FlagExistsAndWasAssigned) {
   EXPECT_EQ(false, info.has_validator_fn);
 }
 
-TEST(GetCommandLineFlagInfoOrDieTest, FlagDoesNotExist) {
+TEST(GetCommandLineFlagInfoOrDieDeathTest, FlagDoesNotExist) {
   EXPECT_DEATH(GetCommandLineFlagInfoOrDie("test_int3210"),
                ".*: flag test_int3210 does not exist");
 }
@@ -1249,7 +1276,7 @@ TEST(ParseCommandLineFlagsAndDashArgs, OneDashArg) {
   EXPECT_EQ(0, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
 }
 
-TEST(ParseCommandLineFlagsUnknownFlag,
+TEST(ParseCommandLineFlagsUnknownFlagDeathTest,
      FlagIsCompletelyUnknown) {
   const char* argv[] = {
     "my_test",
@@ -1263,7 +1290,7 @@ TEST(ParseCommandLineFlagsUnknownFlag,
                "unknown command line flag.*");
 }
 
-TEST(ParseCommandLineFlagsUnknownFlag,
+TEST(ParseCommandLineFlagsUnknownFlagDeathTest,
      BoolFlagIsCompletelyUnknown) {
   const char* argv[] = {
     "my_test",
@@ -1277,7 +1304,7 @@ TEST(ParseCommandLineFlagsUnknownFlag,
                "unknown command line flag.*");
 }
 
-TEST(ParseCommandLineFlagsUnknownFlag,
+TEST(ParseCommandLineFlagsUnknownFlagDeathTest,
      FlagIsNotABool) {
   const char* argv[] = {
     "my_test",
@@ -1351,7 +1378,7 @@ TEST(FlagsValidator, ValidFlagViaSetValue) {
   EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL));
 }
 
-TEST(FlagsValidator, InvalidFlagViaArgv) {
+TEST(FlagsValidatorDeathTest, InvalidFlagViaArgv) {
   const char* argv[] = {
     "my_test",
     "--test_flag=50",
@@ -1385,7 +1412,7 @@ TEST(FlagsValidator, InvalidFlagViaSetValue) {
   EXPECT_TRUE(RegisterFlagValidator(&FLAGS_test_flag, NULL));
 }
 
-TEST(FlagsValidator, InvalidFlagNeverSet) {
+TEST(FlagsValidatorDeathTest, InvalidFlagNeverSet) {
   // If a flag keeps its default value, and that default value is
   // invalid, we should die at argv-parse time.
   const char* argv[] = {
index 52f2cc6..2b97216 100755 (executable)
@@ -130,6 +130,10 @@ Expect $LINENO 1 "/gflags_reporting.cc" "" -helpfull
 # --helpshort should show only flags from the unittest itself
 Expect $LINENO 1 "/gflags_unittest.cc" "/gflags_reporting.cc" --helpshort
 
+# --helpshort should show the tldflag we created in the unittest dir
+Expect $LINENO 1 "tldflag1" "/google.cc" --helpshort
+Expect $LINENO 1 "tldflag2" "/google.cc" --helpshort
+
 # --helpshort should work if the main source file is suffixed with [_-]main
 ExpectExe "$EXE2" $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \
   --helpshort
@@ -158,9 +162,9 @@ Expect $LINENO 1 "/gflags_unittest.cc" "/gflags.cc" \
   -helpmatch=unittest
 
 # if no flags are found with helpmatch or helpon, suggest --help
-Expect $LINENO 1 "No modules matched" "/commandlineflags_unittest.cc" \
+Expect $LINENO 1 "No modules matched" "/gflags_unittest.cc" \
   -helpmatch=nosuchsubstring
-Expect $LINENO 1 "No modules matched" "/commandlineflags_unittest.cc" \
+Expect $LINENO 1 "No modules matched" "/gflags_unittest.cc" \
   -helpon=nosuchmodule
 
 # helppackage shows all the flags in the same dir as this unittest