Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Added CTest targets to perform basic test of --list-tests and --list-tags options.

Commit
69a3f161f9117cab7cb89398c9326d767e06b3e1
Author
Fraser Hutchison ·
Parents
625338645856

Files · Download .tar.gz

Changes

 projects/CMake/CMakeLists.txt | 49 +++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt
index cff62616..5e4d8517 100644
--- a/projects/CMake/CMakeLists.txt
+++ b/projects/CMake/CMakeLists.txt
@@ -1,37 +1,40 @@
 cmake_minimum_required(VERSION 2.8)
 
-project(Catch C CXX)
-message("configure: Catch/SelfTest")
+project(Catch)
 
 # define some folders
-set(CATCH_DIR     "${CMAKE_CURRENT_SOURCE_DIR}/../..")
+get_filename_component(CATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
+get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH)
 set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
-set(SCRIPTS_DIR   ${CATCH_DIR}/scripts)
 
 # define the sources of the self test
-set(
-    SOURCES
-	${SELF_TEST_DIR}/ApproxTests.cpp
-	${SELF_TEST_DIR}/BDDTests.cpp
-	${SELF_TEST_DIR}/catch_self_test.cpp
-	${SELF_TEST_DIR}/ClassTests.cpp
-	${SELF_TEST_DIR}/CmdLineTests.cpp
-	${SELF_TEST_DIR}/ConditionTests.cpp
-	${SELF_TEST_DIR}/ExceptionTests.cpp
-	${SELF_TEST_DIR}/GeneratorTests.cpp
-	${SELF_TEST_DIR}/MessageTests.cpp
-	${SELF_TEST_DIR}/MiscTests.cpp
-	${SELF_TEST_DIR}/SectionTrackerTests.cpp
-	${SELF_TEST_DIR}/TestMain.cpp
-	${SELF_TEST_DIR}/TrickyTests.cpp
-	${SELF_TEST_DIR}/VariadicMacrosTests.cpp
+set(SOURCES
+    ${SELF_TEST_DIR}/ApproxTests.cpp
+    ${SELF_TEST_DIR}/BDDTests.cpp
+    ${SELF_TEST_DIR}/catch_self_test.cpp
+    ${SELF_TEST_DIR}/ClassTests.cpp
+    ${SELF_TEST_DIR}/CmdLineTests.cpp
+    ${SELF_TEST_DIR}/ConditionTests.cpp
+    ${SELF_TEST_DIR}/ExceptionTests.cpp
+    ${SELF_TEST_DIR}/GeneratorTests.cpp
+    ${SELF_TEST_DIR}/MessageTests.cpp
+    ${SELF_TEST_DIR}/MiscTests.cpp
+    ${SELF_TEST_DIR}/SectionTrackerTests.cpp
+    ${SELF_TEST_DIR}/TestMain.cpp
+    ${SELF_TEST_DIR}/TrickyTests.cpp
+    ${SELF_TEST_DIR}/VariadicMacrosTests.cpp
 )
 
 # configure the executable
 include_directories(${CATCH_DIR}/include)
 add_executable(SelfTest ${SOURCES})
 
-# configure unit tests via ctest
+# configure unit tests via CTest
 enable_testing()
-add_test(NAME SelfTest_run COMMAND SelfTest)
-#add_test(NAME SelfTest_run COMMAND python ${SCRIPTS_DIR}/approvalTests.py "${CMAKE_CURRENT_BINARY_DIR}/SelfTest")
+add_test(NAME RunTests COMMAND SelfTest)
+
+add_test(NAME ListTests COMMAND SelfTest --list-tests)
+set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases")
+
+add_test(NAME ListTags COMMAND SelfTest --list-tags)
+set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")