mirror of
https://github.com/catchorg/Catch2.git
synced 2025-04-18 23:54:47 +02:00
Fix bug where catch_discover_tests
fails when no TEST_CASE
s are present
This commit is contained in:
parent
914aeecfe2
commit
76f70b1403
@ -143,6 +143,12 @@ function(catch_discover_tests_impl)
|
|||||||
# Speed-up reparsing by cutting away unneeded parts of JSON.
|
# Speed-up reparsing by cutting away unneeded parts of JSON.
|
||||||
string(JSON test_listing GET "${listing_output}" "listings" "tests")
|
string(JSON test_listing GET "${listing_output}" "listings" "tests")
|
||||||
string(JSON num_tests LENGTH "${test_listing}")
|
string(JSON num_tests LENGTH "${test_listing}")
|
||||||
|
|
||||||
|
# Exit early if no tests are detected
|
||||||
|
if(num_tests STREQUAL "0")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
# CMake's foreach-RANGE is inclusive, so we have to subtract 1
|
# CMake's foreach-RANGE is inclusive, so we have to subtract 1
|
||||||
math(EXPR num_tests "${num_tests} - 1")
|
math(EXPR num_tests "${num_tests} - 1")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user