diff options
author | Francesco Guastella <francesco.guastella@bisimulations.com> | 2021-12-20 17:35:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-07 14:25:57 (GMT) |
commit | 1f9554d4e95087a63b3ab8279cfbda6c3b25004d (patch) | |
tree | edebf6852b6b9a3bc82354167f38b0d6667e7c17 /Tests/RunCMake/GoogleTest/fake_gtest.cpp | |
parent | 353318cc53b87f647141e8d12e79bd4b20be489b (diff) | |
download | CMake-1f9554d4e95087a63b3ab8279cfbda6c3b25004d.zip CMake-1f9554d4e95087a63b3ab8279cfbda6c3b25004d.tar.gz CMake-1f9554d4e95087a63b3ab8279cfbda6c3b25004d.tar.bz2 |
GoogleTest: Fix regex matching all dots in the suite name
Diffstat (limited to 'Tests/RunCMake/GoogleTest/fake_gtest.cpp')
-rw-r--r-- | Tests/RunCMake/GoogleTest/fake_gtest.cpp | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index b2a5cb4..36f1d3c 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -1,6 +1,8 @@ #include <iostream> #include <string> +#define ARRAY_SIZE(a) sizeof(a) / sizeof(*a) + int main(int argc, char** argv) { // Note: GoogleTest.cmake doesn't actually depend on Google Test as such; @@ -16,11 +18,14 @@ int main(int argc, char** argv) if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") { if (!is_typed_only) { - std::cout << "basic." << std::endl; - std::cout << " case_foo" << std::endl; - std::cout << " case_bar" << std::endl; - std::cout << " DISABLED_disabled_case" << std::endl; - std::cout << " DISABLEDnot_really_case" << std::endl; + const char* basic_suite_names[] = { "basic.", "ns.basic." }; + for (size_t i = 0; i < ARRAY_SIZE(basic_suite_names); i++) { + std::cout << basic_suite_names[i] << std::endl; + std::cout << " case_foo" << std::endl; + std::cout << " case_bar" << std::endl; + std::cout << " DISABLED_disabled_case" << std::endl; + std::cout << " DISABLEDnot_really_case" << std::endl; + } } if (!is_basic_only && !is_typed_only) { std::cout << "DISABLED_disabled." << std::endl; @@ -29,19 +34,30 @@ int main(int argc, char** argv) std::cout << " case" << std::endl; } if (!is_basic_only) { - std::cout << "typed/0. # TypeParam = short" << std::endl; - std::cout << " case" << std::endl; - std::cout << "typed/1. # TypeParam = float" << std::endl; - std::cout << " case" << std::endl; + const char* typed_suite_names[] = { "typed", "ns.typed" }; + for (size_t i = 0; i < ARRAY_SIZE(typed_suite_names); i++) { + std::cout << typed_suite_names[i] << "/0. # TypeParam = short" + << std::endl; + std::cout << " case" << std::endl; + std::cout << typed_suite_names[i] << "/1. # TypeParam = float" + << std::endl; + std::cout << " case" << std::endl; + } } if (!is_basic_only && !is_typed_only) { - std::cout << "value/test." << std::endl; - std::cout << " case/0 # GetParam() = 1" << std::endl; - std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; - std::cout << "param/special." << std::endl; - std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; - std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl; - std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl; + const char* value_suite_names[] = { "value", "ns.value" }; + for (size_t i = 0; i < ARRAY_SIZE(value_suite_names); i++) { + std::cout << value_suite_names[i] << "/test." << std::endl; + std::cout << " case/0 # GetParam() = 1" << std::endl; + std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; + } + const char* param_suite_names[] = { "param", "ns.param" }; + for (size_t j = 0; j < ARRAY_SIZE(param_suite_names); j++) { + std::cout << param_suite_names[j] << "/special." << std::endl; + std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; + std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl; + std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl; + } } return 0; } |