Skip to content

Commit

Permalink
Minor test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
p-ranav committed Nov 21, 2019
1 parent 7e70c43 commit d5f48fa
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/test_optional_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ DOCTEST_TEST_CASE("Argument '-' is not an optional argument [optional_arguments]
REQUIRE(program.get<std::string>("input") == "-");
}

DOCTEST_TEST_CASE("Argument '-' is not an optional argument but '-l' is [optional_arguments]") {
argparse::ArgumentParser program("test");
program.add_argument("-l")
.default_value(false)
.implicit_value(true);
program.add_argument("input");
program.parse_args({ "./test.exe", "-l", "-"});
REQUIRE(program.get<bool>("-l") == true);
REQUIRE(program.get<std::string>("input") == "-");
}

DOCTEST_TEST_CASE("Argument '-l' is an optional argument but '-' is not [optional_arguments]") {
argparse::ArgumentParser program("test");
program.add_argument("-l")
.default_value(false)
.implicit_value(true);
program.add_argument("input");
program.parse_args({ "./test.exe", "-", "-l"});
REQUIRE(program.get<bool>("-l") == true);
REQUIRE(program.get<std::string>("input") == "-");
}

DOCTEST_TEST_CASE("Parse toggle arguments with implicit value [optional_arguments]") {
argparse::ArgumentParser program("test");
program.add_argument("--verbose")
Expand Down

0 comments on commit d5f48fa

Please sign in to comment.