diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2016-05-06 15:33:23 -0400 |
---|---|---|
committer | Taylor C. Richberger <taywee@gmx.com> | 2016-05-06 15:33:23 -0400 |
commit | dabfd73fc1387c434fd5f10cf661a01e64252e04 (patch) | |
tree | 516f1db8e2891b85b0d40d31d0aba28dc67a0b3d /test.cxx | |
parent | Merge branch '10-help-generator-parameters-should-be-in-a-structure' into 'ma... (diff) | |
parent | add overloads and tests, and improve help generation in general (diff) | |
download | args.hxx-dabfd73fc1387c434fd5f10cf661a01e64252e04.tar.xz |
Merge branch '8-argumentparser-help-should-be-overloaded-and-should-also-have-an-overloaded-operator-method' into 'master'
add overloads and tests, and improve help generation in general
Closes #8
See merge request !5
Diffstat (limited to 'test.cxx')
-rw-r--r-- | test.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -245,3 +245,18 @@ TEST_CASE("Custom parser prefixes (Some Windows styles)", "[args]") REQUIRE(input.value == "/dev/null"); REQUIRE_FALSE(output); } + +TEST_CASE("Help menu can be grabbed as a string, passed into a stream, or by using the overloaded stream operator", "[args]") +{ + std::ostream null(nullptr); + args::ArgumentParser parser("This command likes to break your disks"); + args::HelpFlag help(parser, "HELP", "Show this help menu.", args::Matcher({"help"})); + args::ArgFlag<long> bs(parser, "BYTES", "Block size", args::Matcher({"bs"}), 512); + args::ArgFlag<long> skip(parser, "BYTES", "Bytes to skip", args::Matcher({"skip"}), 0); + args::ArgFlag<std::string> input(parser, "BLOCK SIZE", "Block size", args::Matcher({"if"})); + args::ArgFlag<std::string> output(parser, "BLOCK SIZE", "Block size", args::Matcher({"of"})); + parser.ParseArgs(std::vector<std::string>{"--skip=8", "--if=/dev/null"}); + null << parser.Help(); + parser.Help(null); + null << parser; +} |