From a411826aafa1ad3fc5c900eac3f025eb2176f185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 5 Jan 2023 23:40:19 +0100 Subject: [PATCH] --allow-running-no-tests also allows all tests to be skipped --- src/catch2/catch_session.cpp | 3 ++- tests/CMakeLists.txt | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index c89368815f..43465f0c46 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -342,7 +342,8 @@ namespace Catch { } if ( totals.testCases.total() > 0 && - totals.testCases.total() == totals.testCases.skipped ) { + totals.testCases.total() == totals.testCases.skipped + && !m_config->zeroTestsCountAsSuccess() ) { return 4; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 464fb683ac..023f478b83 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -273,6 +273,10 @@ add_test(NAME TestSpecs::OverrideFailureWithNoMatchedTests COMMAND $ "___nonexistent_test___" --allow-running-no-tests ) +add_test(NAME TestSpecs::OverrideAllSkipFailure + COMMAND $ "tests can be skipped dynamically at runtime" --allow-running-no-tests +) + add_test(NAME TestSpecs::NonMatchingTestSpecIsRoundTrippable COMMAND $ Tracker, "this test does not exist" "[nor does this tag]" )