diff options
| author | Martin Hořeňovský | 2021-12-13 15:15:23 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-12-18 20:50:00 +0100 |
| commit | 9f2dca5384a6a8f9f37a7dc2d998cac616545592 (patch) | |
| tree | 181d46f4eb905903e08af58a8a35108f87a24505 /src/catch2/catch_session.cpp | |
| parent | 602e484f027ccdfb59cfde852e20283ad1635f81 (diff) | |
| download | catch3-9f2dca5384a6a8f9f37a7dc2d998cac616545592.tar.gz | |
Exit with non-0 return code if no tests were run
A new flag, `--allow-running-no-tests` was added to override this
behaviour if exit code of 0 was desired.
This change also made `-w NoTests` obsolete, and so it has been
removed.
Diffstat (limited to 'src/catch2/catch_session.cpp')
| -rw-r--r-- | src/catch2/catch_session.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index ff5e4cd8..647dcfa3 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -105,12 +105,10 @@ namespace Catch { } private: - using Tests = std::set<TestCaseHandle const*>; - IStreamingReporter* m_reporter; Config const* m_config; RunContext m_context; - Tests m_tests; + std::set<TestCaseHandle const*> m_tests; TestSpec::Matches m_matches; }; @@ -303,8 +301,10 @@ namespace Catch { TestGroup tests { CATCH_MOVE(reporter), m_config.get() }; auto const totals = tests.execute(); - if( m_config->warnAboutNoTests() && totals.error == -1 ) + if ( totals.testCases.total() == 0 + && !m_config->zeroTestsCountAsSuccess() ) { return 2; + } // Note that on unices only the lower 8 bits are usually used, clamping // the return value to 255 prevents false negative when some multiple |