Skip to content

Commit a15f718

Browse files
TheStormNhorenmar
authored andcommitted
Optimize JSON parsing in catch_discover_tests()
1 parent 191fa38 commit a15f718

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

extras/CatchAddTests.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,13 @@ function(catch_discover_tests_impl)
199199
math(EXPR num_tests "${num_tests} - 1")
200200

201201
foreach(idx RANGE ${num_tests})
202-
string(JSON single_test GET ${test_listing} ${idx})
203-
string(JSON test_tags GET "${single_test}" "tags")
204-
string(JSON plain_name GET "${single_test}" "name")
202+
if(add_tags)
203+
string(JSON single_test GET "${test_listing}" ${idx})
204+
string(JSON test_tags GET "${single_test}" "tags")
205+
string(JSON plain_name GET "${single_test}" "name")
206+
else()
207+
string(JSON plain_name GET "${test_listing}" ${idx} "name")
208+
endif()
205209

206210
# Escape characters in test case names that would be parsed by Catch2
207211
# Note that the \ escaping must happen FIRST! Do not change the order.

0 commit comments

Comments
 (0)