mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
added target name to test name and labels
This commit is contained in:
parent
aac594aae3
commit
4b086bd5b5
@ -108,19 +108,31 @@ function(ParseFile SourceFile TestTarget)
|
|||||||
else()
|
else()
|
||||||
set(CTestName "${Name}")
|
set(CTestName "${Name}")
|
||||||
endif()
|
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)
|
if(TestStringsLength EQUAL 2)
|
||||||
list(GET TestStrings 1 Tags)
|
list(GET TestStrings 1 Tags)
|
||||||
string(TOLOWER "${Tags}" 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}")
|
||||||
string(REPLACE "[" "" Tags "${Tags}")
|
string(REPLACE "[" "" Tags "${Tags}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
list(APPEND Labels ${Tags})
|
||||||
|
|
||||||
PrintDebugMessage("Adding test \"${CTestName}\"")
|
PrintDebugMessage("Adding test \"${CTestName}\"")
|
||||||
|
if(Labels)
|
||||||
|
PrintDebugMessage("Setting labels to ${Labels}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add the test and set its properties
|
# Add the test and set its properties
|
||||||
add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters})
|
add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters})
|
||||||
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||||
LABELS "${Tags}")
|
LABELS "${Labels}")
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user