mirror of
https://github.com/Kitware/CMake.git
synced 2026-06-24 08:47:59 +00:00
Google Test returns parameter values for parametrized tests in two ways:
* As part of the test name - if a name_generator has been provided in
the test this will be the generated string, otherwise gtest will just
number all tests
* In a separate field of the json (or the text output) - this seems to
be a byte representation of the input data if the input data cannot be
converted to a string.
If the cmake parameter `NO_PRETTY_VALUES` to `gtest_discover_tests` has
not been set, the auto-generated test index - i.e. if no `name_generator
has been specified - is supposed to be replaced by the value parameter
from category 2 above. However, since commit 1cdceae8e3 (GoogleTest:
Parse discovered test list from JSON output if supported, 2025-05-02,
v4.2.0-rc1~533^2~2), the logic has been broken, in that the test suffix
is always replaced even though a name_generator has been configured.
Fix this by checking if the last part of the test name is an integer and
only then replace it.
Fixes: #27846