parent
a150450486
commit
c74846a891
@ -2243,6 +2243,7 @@ OptionParser::parse(int argc, const char* const* argv)
|
|||||||
{
|
{
|
||||||
if (m_allow_unrecognised)
|
if (m_allow_unrecognised)
|
||||||
{
|
{
|
||||||
|
unmatched.push_back(std::string("-") + s[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//error
|
//error
|
||||||
|
@ -656,6 +656,7 @@ TEST_CASE("Unrecognised options", "[options]") {
|
|||||||
"--long",
|
"--long",
|
||||||
"-su",
|
"-su",
|
||||||
"--another_unknown",
|
"--another_unknown",
|
||||||
|
"-a",
|
||||||
});
|
});
|
||||||
|
|
||||||
auto** argv = av.argv();
|
auto** argv = av.argv();
|
||||||
@ -669,7 +670,7 @@ TEST_CASE("Unrecognised options", "[options]") {
|
|||||||
options.allow_unrecognised_options();
|
options.allow_unrecognised_options();
|
||||||
auto result = options.parse(argc, argv);
|
auto result = options.parse(argc, argv);
|
||||||
auto& unmatched = result.unmatched();
|
auto& unmatched = result.unmatched();
|
||||||
CHECK((unmatched == std::vector<std::string>{"--unknown", "--another_unknown"}));
|
CHECK((unmatched == std::vector<std::string>{"--unknown", "-u", "--another_unknown", "-a"}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user