Commit dc8543a4 authored by Andreas Schuh's avatar Andreas Schuh

Add test which uses gflags_declare.h.

Update issue 79
Added a test which uses gflags_declare.h as any other project would use it to avoid such avoidable build configuration mistakes.
parent 94c23575
......@@ -154,6 +154,13 @@ add_gflags_test(always_fail 1 "ERROR: failed validation of new value 'true' for
# debugger abort() intervention in case of Debug configuration.
#add_gflags_test(deadlock_if_cant_lock 0 "PASS" "" gflags_unittest --deadlock_if_cant_lock)
# ----------------------------------------------------------------------------
# use gflags_declare.h
add_executable (gflags_declare_test gflags_declare_test.cc gflags_declare_flags.cc)
add_test(NAME gflags_declare COMMAND gflags_declare_test --message "Hello gflags!")
set_tests_properties(gflags_declare PROPERTIES PASS_REGULAR_EXPRESSION "Hello gflags!")
# ----------------------------------------------------------------------------
# (negative) compilation tests
if (BUILD_NC_TESTS)
......
#include <iostream>
#include <gflags/gflags_declare.h>
DECLARE_string(message); // in gflags_delcare_test.cc
void print_message()
{
std::cout << FLAGS_message << std::endl;
}
#include <gflags/gflags.h>
DEFINE_string(message, "", "The message to print");
void print_message(); // in gflags_declare_flags.cc
int main(int argc, char **argv)
{
gflags::SetUsageMessage("Test compilation and use of gflags_declare.h");
gflags::ParseCommandLineFlags(&argc, &argv, true);
print_message();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment