diff options
author | Brad King <brad.king@kitware.com> | 2022-07-26 18:03:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-07-27 11:03:31 (GMT) |
commit | 77fcb00a2b76518c0db861a96a8f4857a50b140e (patch) | |
tree | 114e4ae50d6f1679f6ef0344bd4d1d70e371ffc7 /Tests/CMakeLib | |
parent | 5fc4e121a18d9e403f1541348c2889e9bc153791 (diff) | |
download | CMake-77fcb00a2b76518c0db861a96a8f4857a50b140e.zip CMake-77fcb00a2b76518c0db861a96a8f4857a50b140e.tar.gz CMake-77fcb00a2b76518c0db861a96a8f4857a50b140e.tar.bz2 |
cmArgumentParser: Propagate constructors through binding wrapper types
Diffstat (limited to 'Tests/CMakeLib')
-rw-r--r-- | Tests/CMakeLib/testArgumentParser.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx index 5460356..dad5b85 100644 --- a/Tests/CMakeLib/testArgumentParser.cxx +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -39,6 +39,15 @@ struct Result : public ArgumentParser::ParseResult cm::optional<std::vector<std::vector<std::string>>> Multi3; cm::optional<std::vector<std::vector<std::string>>> Multi4; + ArgumentParser::Maybe<std::string> UnboundMaybe{ 'u', 'n', 'b', 'o', + 'u', 'n', 'd' }; + ArgumentParser::MaybeEmpty<std::vector<std::string>> UnboundMaybeEmpty{ + 1, "unbound" + }; + ArgumentParser::NonEmpty<std::vector<std::string>> UnboundNonEmpty{ + 1, "unbound" + }; + std::vector<cm::string_view> ParsedKeywords; }; @@ -69,6 +78,7 @@ bool verifyResult(Result const& result, { static std::vector<std::string> const foobar = { "foo", "bar" }; static std::vector<std::string> const barfoo = { "bar", "foo" }; + static std::vector<std::string> const unbound = { "unbound" }; static std::vector<cm::string_view> const parsedKeywords = { /* clang-format off */ "OPTION_1", @@ -133,6 +143,10 @@ bool verifyResult(Result const& result, ASSERT_TRUE(unparsedArguments.size() == 1); ASSERT_TRUE(unparsedArguments[0] == "bar"); + ASSERT_TRUE(result.UnboundMaybe == "unbound"); + ASSERT_TRUE(result.UnboundMaybeEmpty == unbound); + ASSERT_TRUE(result.UnboundNonEmpty == unbound); + ASSERT_TRUE(result.ParsedKeywords == parsedKeywords); ASSERT_TRUE(result.GetKeywordErrors().size() == keywordErrors.size()); |