summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers+gflags@google.com>2011-08-04 00:02:39 +0000
committerCraig Silverstein <csilvers+gflags@google.com>2011-08-04 00:02:39 +0000
commit8233556d44d6d296130887d5065bff1c44ed1e1c (patch)
tree77534deb375915a7fde363f25f788af25e3b0486 /src
parent404970d679c852d665dadc372203c4477b2ce17c (diff)
downloadgflags-8233556d44d6d296130887d5065bff1c44ed1e1c.tar.gz
gflags-8233556d44d6d296130887d5065bff1c44ed1e1c.tar.bz2
gflags-8233556d44d6d296130887d5065bff1c44ed1e1c.zip
Add a new unittest case, that tests the --help output for a
really long helpstring. Opensource gflags had a bug where we were cutting off the output too soon; this test should protect against such a thing. R=nilton DELTA=16 (16 added, 0 deleted, 0 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=2885 git-svn-id: https://gflags.googlecode.com/svn/trunk@58 6586e3c6-dcc4-952a-343f-ff74eb82781d
Diffstat (limited to 'src')
-rw-r--r--src/gflags_unittest.cc13
-rwxr-xr-xsrc/gflags_unittest.sh3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/gflags_unittest.cc b/src/gflags_unittest.cc
index d64febb..890e157 100644
--- a/src/gflags_unittest.cc
+++ b/src/gflags_unittest.cc
@@ -127,6 +127,19 @@ DEFINE_string(unused_string, "unused", "");
// These flags are used by gflags_unittest.sh
DEFINE_bool(changed_bool1, false, "changed");
DEFINE_bool(changed_bool2, false, "changed");
+DEFINE_bool(long_helpstring, false,
+ "This helpstring goes on forever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever and ever and ever and ever and ever and ever and ever and "
+ "ever. This is the end of a long helpstring");
+
static bool AlwaysFail(const char* flag, bool value) { return value == false; }
DEFINE_bool(always_fail, false, "will fail to validate when you set it");
diff --git a/src/gflags_unittest.sh b/src/gflags_unittest.sh
index 39b03c5..c81e41e 100755
--- a/src/gflags_unittest.sh
+++ b/src/gflags_unittest.sh
@@ -111,6 +111,9 @@ Expect $LINENO 0 "PASS" ""
# --help should show all flags, including flags from gflags_reporting
Expect $LINENO 1 "/gflags_reporting.cc" "" --help
+# Make sure that --help prints even very long helpstrings.
+Expect $LINENO 1 "end of a long helpstring" "" --help
+
# Make sure --help reflects flag changes made before flag-parsing
Expect $LINENO 1 \
"-changed_bool1 (changed) type: bool default: true" "" --help