diff options
author | Ayaz Salikhov <mathbunnyru@gmail.com> | 2019-01-18 14:53:25 +0300 |
---|---|---|
committer | Ayaz Salikhov <mathbunnyru@gmail.com> | 2019-01-18 14:53:56 +0300 |
commit | 7c4164bf404d899b6d4c74beb1070da5647f55a2 (patch) | |
tree | 8bc6f7d761ae7657d7716e26f77cb549714d4930 /googletest/include/gtest/gtest-param-test.h | |
parent | 0adeadd2830211f827fd2908e4621f6a4afa810c (diff) | |
download | googletest-7c4164bf404d899b6d4c74beb1070da5647f55a2.tar.gz googletest-7c4164bf404d899b6d4c74beb1070da5647f55a2.zip |
Fix INSTANTIATE_TEST_CASE_P with zero variadic arguments
Diffstat (limited to 'googletest/include/gtest/gtest-param-test.h')
-rw-r--r-- | googletest/include/gtest/gtest-param-test.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h index a0eecc69..81b1a4bc 100644 --- a/googletest/include/gtest/gtest-param-test.h +++ b/googletest/include/gtest/gtest-param-test.h @@ -544,9 +544,9 @@ 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 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 +// 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. // // testing::PrintToStringParamName is a builtin test suffix generator that @@ -556,15 +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 INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, generator, ...) \ +#define INSTANTIATE_TEST_SUITE_P(prefix, test_suite_name, ...) \ static ::testing::internal::ParamGenerator<test_suite_name::ParamType> \ gtest_##prefix##test_suite_name##_EvalGenerator_() { \ - return generator; \ + return VA_GETFIRST(__VA_ARGS__); \ } \ static ::std::string gtest_##prefix##test_suite_name##_EvalGenerateName_( \ const ::testing::TestParamInfo<test_suite_name::ParamType>& info) { \ - return ::testing::internal::GetParamNameGen<test_suite_name::ParamType>( \ - __VA_ARGS__)(info); \ + return ::testing::internal::CreateParamGenerator< \ + test_suite_name::ParamType>(VA_GETREST(__VA_ARGS__, 0))(info); \ } \ static int gtest_##prefix##test_suite_name##_dummy_ \ GTEST_ATTRIBUTE_UNUSED_ = \ |