diff options
author | Ashley Hedberg <ahedberg@google.com> | 2019-01-30 19:26:14 (GMT) |
---|---|---|
committer | Ashley Hedberg <ahedberg@google.com> | 2019-01-30 19:26:14 (GMT) |
commit | 8e37822b4b216434eac1173a19ecd0dd1390a99a (patch) | |
tree | 842069fb4eab34a3815e7db3b06578d26bab51b9 /googletest/include/gtest/gtest-param-test.h | |
parent | ce29e55cfcbbadfdb41542bafa6104b26c7e3e5c (diff) | |
parent | 7c4164bf404d899b6d4c74beb1070da5647f55a2 (diff) | |
download | googletest-8e37822b4b216434eac1173a19ecd0dd1390a99a.zip googletest-8e37822b4b216434eac1173a19ecd0dd1390a99a.tar.gz googletest-8e37822b4b216434eac1173a19ecd0dd1390a99a.tar.bz2 |
Merge pull request #2063 from mathbunnyru:master
PiperOrigin-RevId: 231456275
Diffstat (limited to 'googletest/include/gtest/gtest-param-test.h')
-rw-r--r-- | googletest/include/gtest/gtest-param-test.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index 3f712cf..a0eecc6 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -544,11 +544,10 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3, GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::AddToRegistry(); \ void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody() -// The last argument to INSTANTIATE_TEST_SUITE_P allows the user to specify -// generator and an optional function or functor that generates custom test name -// suffixes based on the test parameters. Such a function or functor should -// accept one argument of type testing::TestParamInfo<class ParamType>, and -// return std::string. +// The optional last argument to INSTANTIATE_TEST_SUITE_P allows the user +// to specify a function or functor that generates custom test name suffixes +// based on the test parameters. The function should accept one argument of +// type testing::TestParamInfo<class ParamType>, and return std::string. // // testing::PrintToStringParamName is a builtin test suffix generator that // returns the value of testing::PrintToString(GetParam()). @@ -557,21 +556,15 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3, // alphanumeric characters or underscore. Because PrintToString adds quotes // to std::string and C strings, it won't work for these types. -#define GTEST_EXPAND_(arg) arg -#define GTEST_GET_FIRST_(first, ...) first -#define GTEST_GET_SECOND_(first, second, ...) second - -#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ +#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, generator, ...) \ static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \ gtest_##prefix##test_suite_name##_EvalGenerator_() { \ - return GTEST_EXPAND_(GTEST_GET_FIRST_(__VA_ARGS__, DUMMY_PARAM_)); \ + return generator; \ } \ static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \ - return GTEST_EXPAND_(GTEST_GET_SECOND_( \ - __VA_ARGS__, \ - ::testing::internal::DefaultParamName<test_suite_name::ParamType>, \ - DUMMY_PARAM_))(info); \ + return ::testing::internal::GetParamNameGen<test_suite_name::ParamType>( \ + __VA_ARGS__)(info); \ } \ static int gtest_##prefix##test_suite_name##_dummy_ \ GTEST_ATTRIBUTE_UNUSED_ = \ |