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 target name to test name and labels
- Commit
4b086bd5b5e2e03a60f59b3e3101baab996f2c7c- Author
- dvirtz ·
- Parents
aac594aae369
Changes
contrib/ParseAndAddCatchTests.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake index 42c6f34f..6c3e6632 100644 --- a/contrib/ParseAndAddCatchTests.cmake +++ b/contrib/ParseAndAddCatchTests.cmake @@ -108,19 +108,31 @@ function(ParseFile SourceFile TestTarget) else() set(CTestName "${Name}") endif() + set(CTestName "${TestTarget}:${CTestName}") + # add target to labels to enable running all tests added from this target + set(Labels ${TestTarget}) if(TestStringsLength EQUAL 2) list(GET TestStrings 1 Tags) string(TOLOWER "${Tags}" Tags) + # remove target from labels if the test is hidden + if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*") + list(REMOVE_ITEM Labels ${TestTarget}) + endif() string(REPLACE "]" ";" Tags "${Tags}") string(REPLACE "[" "" Tags "${Tags}") endif() + list(APPEND Labels ${Tags}) + PrintDebugMessage("Adding test \"${CTestName}\"") + if(Labels) + PrintDebugMessage("Setting labels to ${Labels}") + endif() # Add the test and set its properties add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters}) set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran" - LABELS "${Tags}") + LABELS "${Labels}") endforeach() endfunction()