diff options
author | Pavel Belikov <pavel.fuchs.belikov@gmail.com> | 2018-05-04 20:11:55 +0300 |
---|---|---|
committer | Pavel Belikov <pavel.fuchs.belikov@gmail.com> | 2018-05-04 20:11:55 +0300 |
commit | de3b674ea4baba4b699ebaddbb15639c024e3a0f (patch) | |
tree | e5724532eeac0ea6b12a53bbde43ae41e5309960 | |
parent | Merge pull request #58 from bitc/master (diff) | |
download | args.hxx-de3b674ea4baba4b699ebaddbb15639c024e3a0f.tar.xz |
Add test for windows minmax
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | test/windows_h.cxx | 31 |
2 files changed, 38 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d0aaa69..76caba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ else () endif () add_executable(argstest-multiple-inclusion test/multiple_inclusion_1.cxx test/multiple_inclusion_2.cxx) + target_link_libraries(argstest-multiple-inclusion args) set_property(TARGET argstest-multiple-inclusion PROPERTY CXX_STANDARD 11) @@ -43,6 +44,12 @@ add_executable(gitlike examples/gitlike.cxx) target_link_libraries(gitlike args) set_property(TARGET gitlike PROPERTY CXX_STANDARD 11) +if (WIN32) + add_executable(argstest-windows-h test/windows_h.cxx) + target_link_libraries(argstest-windows-h args) + set_property(TARGET argstest-windows-h PROPERTY CXX_STANDARD 11) +endif () + add_executable(completion examples/completion.cxx) target_link_libraries(completion args) set_property(TARGET completion PROPERTY CXX_STANDARD 11) diff --git a/test/windows_h.cxx b/test/windows_h.cxx new file mode 100644 index 0000000..a9befe1 --- /dev/null +++ b/test/windows_h.cxx @@ -0,0 +1,31 @@ +#include "windows.h" +#include <iostream> +#include <args.hxx> + +int main() +{ + args::ArgumentParser parser("This is a test program.", "This goes after the options."); + args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"}); + args::CompletionFlag completion(parser, {"complete"}); + try + { + parser.ParseCLI(argc, argv); + } + catch (args::Completion& e) + { + std::cout << e.what(); + return 0; + } + catch (args::Help&) + { + std::cout << parser; + return 0; + } + catch (args::ParseError& e) + { + std::cerr << e.what() << std::endl; + std::cerr << parser; + return 1; + } + return 0; +} |