Skip to content

Commit

Permalink
Added a test for handling an invalid option
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmux committed May 11, 2023
1 parent cb45646 commit 95199e8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/command_line/arguments.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,19 @@ TEST_CASE("parse command line argument simple flag", "[command_line::parseArgume
const auto &version{std::get<flag_t>(*argsVers.begin())};
REQUIRE(version.name() == "--version"sv);
REQUIRE(!version.value().has_value());

// Check that parsing an invalid option fails
constexpr static auto argsV
{
substrate::make_array<const char *>
({
"program",
"-v",
nullptr,
})
};
const auto resultV{parseArguments(argsV.size(), argsV.data(), programOptions)};
REQUIRE(resultV == std::nullopt);
}

TEST_CASE("parse command line argument flags", "[command_line::parseArguments]")
Expand Down

0 comments on commit 95199e8

Please sign in to comment.