summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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