mirror of
https://github.com/Kitware/CMake.git
synced 2026-07-07 15:17:43 +00:00
GoogleTest: Fix type param tests for suites with many cases
When there were many cases (two digits or more) the "prettier" would fail to recognize the pretty part leaving the test name unprocessed. The fix made sure the processing would work correctly, irrespective of the case number. Before the fix, for the following input: TypedSuite/1. # TypeParam = int case TypedSuite/10. # TypeParam = char case The output would be: TypedSuite/int.case TypedSuite/10. # TypeParam = char.case Now the output will be: TypedSuite/int.case TypedSuite/char.case
This commit is contained in:
committed by
Brad King
parent
c8a955584d
commit
f28f738bd2
@@ -136,7 +136,7 @@ function(gtest_discover_tests_impl)
|
||||
# Module; remove trailing '.' to get just the name...
|
||||
string(REGEX REPLACE "\\.( *#.*)?$" "" suite "${line}")
|
||||
if(line MATCHES "#" AND NOT _NO_PRETTY_TYPES)
|
||||
string(REGEX REPLACE "/[0-9]\\.+ +#.*= +" "/" pretty_suite "${line}")
|
||||
string(REGEX REPLACE "/[0-9]+\\.+ +#.*= +" "/" pretty_suite "${line}")
|
||||
else()
|
||||
set(pretty_suite "${suite}")
|
||||
endif()
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
Test project .*/Tests/RunCMake/GoogleTest/GoogleTest-discovery-arg-change
|
||||
Test #1: typed/short\.case
|
||||
Test #2: typed/float\.case
|
||||
Test #3: ns\.typed/short\.case
|
||||
Test #4: ns\.typed/float\.case
|
||||
Test #[0-9]+: typed/short\.case
|
||||
Test #[0-9]+: typed/float\.case
|
||||
Test #[0-9]+: typed/char\.case
|
||||
Test #[0-9]+: ns\.typed/short\.case
|
||||
Test #[0-9]+: ns\.typed/float\.case
|
||||
Test #[0-9]+: ns\.typed/char\.case
|
||||
|
||||
Total Tests: 4
|
||||
Total Tests: [0-9]+
|
||||
|
||||
@@ -23,10 +23,14 @@ Test project .*
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/float\.case!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/char\.case!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/char\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/short\.case!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/float\.case!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/char\.case!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/char\.case!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:value/test\.case/1!1
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:value/test\.case/"foo"!1
|
||||
|
||||
@@ -23,10 +23,14 @@ Test project .*
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/float\.case!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/char\.case!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/char\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/short\.case!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/float\.case!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/char\.case!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/char\.case!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:value/test\.case/1!2
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:value/test\.case/"foo"!2
|
||||
|
||||
@@ -3,10 +3,14 @@ Test project .*
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/short\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/float\.case!4
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/float\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:typed/char\.case!4
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:typed/char\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/short\.case!4
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/short\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/float\.case!4
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/float\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
*Start +[0-9]+: TEST:ns\.typed/char\.case!4
|
||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: TEST:ns\.typed/char\.case!4 \.+ +Passed +[0-9.]+ sec
|
||||
|
||||
100% tests passed, 0 tests failed out of [0-9]+
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ int main(int argc, char** argv)
|
||||
if (!is_basic_only) {
|
||||
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 << typed_suite_names[i] << "/0. # TypeParam = short\n";
|
||||
std::cout << " case" << std::endl;
|
||||
std::cout << typed_suite_names[i] << "/1. # TypeParam = float"
|
||||
<< std::endl;
|
||||
std::cout << typed_suite_names[i] << "/1. # TypeParam = float\n";
|
||||
std::cout << " case" << std::endl;
|
||||
std::cout << typed_suite_names[i] << "/42. # TypeParam = char\n";
|
||||
std::cout << " case" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user