diff options
author | Brad King <brad.king@kitware.com> | 2014-04-03 16:51:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-04-03 16:51:35 (GMT) |
commit | 7fcf0277c9ee755fa79d7f28a64768236f8437f5 (patch) | |
tree | 306abed6ac03a8204a749c7217159b8a249767ac /Modules | |
parent | 84966ac161a8e73497b8b57a50df4c43cc217e04 (diff) | |
parent | 2e2939c365292d1771d5dd6d2cd8f04e3d2aea44 (diff) | |
download | CMake-7fcf0277c9ee755fa79d7f28a64768236f8437f5.zip CMake-7fcf0277c9ee755fa79d7f28a64768236f8437f5.tar.gz CMake-7fcf0277c9ee755fa79d7f28a64768236f8437f5.tar.bz2 |
Merge topic 'FindGTest-TEST_P'
2e2939c3 FindGTest: Teach GTEST_ADD_TESTS about TEST_P
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindGTest.cmake | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index aa3c235..c4f911d 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -115,11 +115,19 @@ function(GTEST_ADD_TESTS executable extra_args) # obtain sources used for building that executable get_property(ARGN TARGET ${executable} PROPERTY SOURCES) endif() + set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*") foreach(source ${ARGN}) file(READ "${source}" contents) - string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + string(REGEX MATCHALL "TEST_?[FP]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) foreach(hit ${found_tests}) - string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) + string(REGEX MATCH "TEST_?[FP]?" test_type ${hit}) + + # Parameterized tests have a different signature for the filter + if(${test_type} STREQUAL "TEST_P") + string(REGEX REPLACE ${gtest_case_name_regex} "*/\\1.\\2/*" test_name ${hit}) + else() + string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit}) + endif() add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) endforeach() endforeach() |