Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorLeitwolf112026-11-01 22:05:27 +0300
committerLeitwolf112026-11-01 22:05:27 +0300
commit241b5567d09d59e82bff18287c32ada480deb8c0 (patch)
tree24bb446828301b1fdfb60ceef08c2a8fec23ab3e /tests
parent5cbd481125b881a4c2eed74050be9899eb3f23a7 (diff)
downloadcatch3-241b5567d09d59e82bff18287c32ada480deb8c0.tar.gz
Carry mocks in the amalgamated files
Mock.hpp goes into catch_amalgamated.hpp, since tests use it directly, and Mock.cpp into catch_amalgamated.cpp. The test of the amalgamated files now uses a mock, so a file left out fails it.
Diffstat (limited to 'tests')
-rw-r--r--tests/ExtraTests/CMakeLists.txt2
-rw-r--r--tests/ExtraTests/X91-AmalgamatedCatch.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt
index 232b86dc..a9d9a316 100644
--- a/tests/ExtraTests/CMakeLists.txt
+++ b/tests/ExtraTests/CMakeLists.txt
@@ -436,7 +436,7 @@ target_compile_features(AmalgamatedTestCompilation PRIVATE cxx_std_17)
add_test(NAME AmalgamatedFileTest COMMAND AmalgamatedTestCompilation --no-history)
set_tests_properties(AmalgamatedFileTest
PROPERTIES
- PASS_REGULAR_EXPRESSION "3 test\\(s\\): 3 passed[\r\n]+14 assertion\\(s\\)"
+ PASS_REGULAR_EXPRESSION "4 test\\(s\\): 4 passed[\r\n]+16 assertion\\(s\\)"
)
add_executable(ThreadSafetyTests
diff --git a/tests/ExtraTests/X91-AmalgamatedCatch.cpp b/tests/ExtraTests/X91-AmalgamatedCatch.cpp
index 78d45a2c..857c5807 100644
--- a/tests/ExtraTests/X91-AmalgamatedCatch.cpp
+++ b/tests/ExtraTests/X91-AmalgamatedCatch.cpp
@@ -27,6 +27,12 @@ TEST_CASE("Just a dummy test") {
}));
}
+TEST_CASE("Mocks are in the amalgamated files") {
+ CATCH3_MOCK_FUNCTION(twice, int(int));
+ CATCH3_EXPECT_CALL(twice)(2).Returns(4);
+ CHECK(twice(2) == 4);
+}
+
TEMPLATE_TEST_CASE("Trivial template test case", "", char, short) {
STATIC_REQUIRE(sizeof(TestType) <= sizeof(int));
}