Allow enabling multiple warnings in one invocation

This commit is contained in:
Martin Hořeňovský 2021-12-18 20:48:43 +01:00
parent 840acedf62
commit 3cc0c033e4
No known key found for this signature in database
GPG key ID: DE48307B8B0D381A
14 changed files with 165 additions and 11 deletions

View file

@ -25,10 +25,10 @@ namespace Catch {
auto const setWarning = [&]( std::string const& warning ) {
if ( warning == "NoAssertions" ) {
config.warnings = WarnAbout::NoAssertions;
config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::NoAssertions);
return ParserResult::ok( ParseResultType::Matched );
} else if ( warning == "UnmatchedTestSpec" ) {
config.warnings = WarnAbout::UnmatchedTestSpec;
config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::UnmatchedTestSpec);
return ParserResult::ok( ParseResultType::Matched );
}
@ -217,7 +217,7 @@ namespace Catch {
| Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
["-x"]["--abortx"]
( "abort after x failures" )
| Opt( setWarning, "warning name" )
| Opt( accept_many, setWarning, "warning name" )
["-w"]["--warn"]
( "enable warnings" )
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )