Googletest export

Expose more information in SuiteApiResolver diagnostic output

PiperOrigin-RevId: 244179347
This commit is contained in:
misterg
2019-04-18 10:05:29 -04:00
committed by Gennadiy Civil
parent a0d60bed4d
commit fa52cd6363
5 changed files with 554 additions and 12 deletions

View File

@@ -506,7 +506,8 @@ struct SuiteApiResolver : T {
using Test =
typename std::conditional<sizeof(T) != 0, ::testing::Test, void>::type;
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite() {
static SetUpTearDownSuiteFuncType GetSetUpCaseOrSuite(const char* filename,
int line_num) {
SetUpTearDownSuiteFuncType test_case_fp =
GetNotDefaultOrNull(&T::SetUpTestCase, &Test::SetUpTestCase);
SetUpTearDownSuiteFuncType test_suite_fp =
@@ -514,12 +515,14 @@ struct SuiteApiResolver : T {
GTEST_CHECK_(!test_case_fp || !test_suite_fp)
<< "Test can not provide both SetUpTestSuite and SetUpTestCase, please "
"make sure there is only one present ";
"make sure there is only one present at "
<< filename << ":" << line_num;
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
}
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite() {
static SetUpTearDownSuiteFuncType GetTearDownCaseOrSuite(const char* filename,
int line_num) {
SetUpTearDownSuiteFuncType test_case_fp =
GetNotDefaultOrNull(&T::TearDownTestCase, &Test::TearDownTestCase);
SetUpTearDownSuiteFuncType test_suite_fp =
@@ -527,7 +530,8 @@ struct SuiteApiResolver : T {
GTEST_CHECK_(!test_case_fp || !test_suite_fp)
<< "Test can not provide both TearDownTestSuite and TearDownTestCase,"
" please make sure there is only one present ";
" please make sure there is only one present at"
<< filename << ":" << line_num;
return test_case_fp != nullptr ? test_case_fp : test_suite_fp;
}
@@ -706,8 +710,10 @@ class TypeParameterizedTest {
GetTypeName<Type>().c_str(),
nullptr, // No value parameter.
code_location, GetTypeId<FixtureClass>(),
SuiteApiResolver<TestClass>::GetSetUpCaseOrSuite(),
SuiteApiResolver<TestClass>::GetTearDownCaseOrSuite(),
SuiteApiResolver<TestClass>::GetSetUpCaseOrSuite(
code_location.file.c_str(), code_location.line),
SuiteApiResolver<TestClass>::GetTearDownCaseOrSuite(
code_location.file.c_str(), code_location.line),
new TestFactoryImpl<TestClass>);
// Next, recurses (at compile time) with the tail of the type list.
@@ -1412,9 +1418,9 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
#test_suite_name, #test_name, nullptr, nullptr, \
::testing::internal::CodeLocation(__FILE__, __LINE__), (parent_id), \
::testing::internal::SuiteApiResolver< \
parent_class>::GetSetUpCaseOrSuite(), \
parent_class>::GetSetUpCaseOrSuite(__FILE__, __LINE__), \
::testing::internal::SuiteApiResolver< \
parent_class>::GetTearDownCaseOrSuite(), \
parent_class>::GetTearDownCaseOrSuite(__FILE__, __LINE__), \
new ::testing::internal::TestFactoryImpl<GTEST_TEST_CLASS_NAME_( \
test_suite_name, test_name)>); \
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()