diff options
author | Andreas Schuh <andreas.schuh.84@gmail.com> | 2016-02-29 17:12:15 +0000 |
---|---|---|
committer | Andreas Schuh <andreas.schuh.84@gmail.com> | 2016-02-29 17:12:15 +0000 |
commit | 9ef0d5220eb9ebd9044b935b62a02b35024f9686 (patch) | |
tree | 6707973f8161de9b59f82258e38dd2a6f42052ca /test/config | |
parent | 02f318978863a74c74359bc5bf7ab2ed09cf0d87 (diff) | |
download | gflags-9ef0d5220eb9ebd9044b935b62a02b35024f9686.tar.gz gflags-9ef0d5220eb9ebd9044b935b62a02b35024f9686.tar.bz2 gflags-9ef0d5220eb9ebd9044b935b62a02b35024f9686.zip |
enh: Add usage of DEFINE_validator to test project
Diffstat (limited to 'test/config')
-rw-r--r-- | test/config/main.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/config/main.cc b/test/config/main.cc index 5edd9a1..3c033e3 100644 --- a/test/config/main.cc +++ b/test/config/main.cc @@ -3,9 +3,16 @@ DEFINE_string(message, "Hello World!", "The message to print"); +static bool ValidateMessage(const char* flagname, const std::string &message) +{ + return !message.empty(); +} +DEFINE_validator(message, ValidateMessage); + int main(int argc, char **argv) { gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); + gflags::SetVersionString("0.1"); gflags::ParseCommandLineFlags(&argc, &argv, true); std::cout << FLAGS_message << std::endl; gflags::ShutDownCommandLineFlags(); |