summaryrefslogtreecommitdiffstats
path: root/googletest/include
diff options
context:
space:
mode:
authormisterg <misterg@google.com>2019-04-18 14:05:29 (GMT)
committerGennadiy Civil <misterg@google.com>2019-04-18 19:45:49 (GMT)
commitfa52cd63631954b558f144de8508cd8d2463c0e8 (patch)
treee2f8e48c46680b9f19d29348c351253b958f3260 /googletest/include
parenta0d60bed4d0ea17c7130cda16776b9bc8a929d7b (diff)
downloadgoogletest-fa52cd63631954b558f144de8508cd8d2463c0e8.zip
googletest-fa52cd63631954b558f144de8508cd8d2463c0e8.tar.gz
googletest-fa52cd63631954b558f144de8508cd8d2463c0e8.tar.bz2
Googletest export
Expose more information in SuiteApiResolver diagnostic output PiperOrigin-RevId: 244179347
Diffstat (limited to 'googletest/include')
-rw-r--r--googletest/include/gtest/gtest.h4
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h22
-rw-r--r--googletest/include/gtest/internal/gtest-param-util.h4
3 files changed, 18 insertions, 12 deletions
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index cedef93..76f4098 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -2427,8 +2427,8 @@ TestInfo* RegisterTest(const char* test_suite_name, const char* test_name,
return internal::MakeAndRegisterTestInfo(
test_suite_name, test_name, type_param, value_param,
internal::CodeLocation(file, line), internal::GetTypeId<TestT>(),
- internal::SuiteApiResolver<TestT>::GetSetUpCaseOrSuite(),
- internal::SuiteApiResolver<TestT>::GetTearDownCaseOrSuite(),
+ internal::SuiteApiResolver<TestT>::GetSetUpCaseOrSuite(file, line),
+ internal::SuiteApiResolver<TestT>::GetTearDownCaseOrSuite(file, line),
new FactoryImpl{std::move(factory)});
}
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 4988717..2732660 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -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()
diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h
index 3ed7d22..e900b3f 100644
--- a/googletest/include/gtest/internal/gtest-param-util.h
+++ b/googletest/include/gtest/internal/gtest-param-util.h
@@ -571,8 +571,8 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
nullptr, // No type parameter.
PrintToString(*param_it).c_str(), code_location_,
GetTestSuiteTypeId(),
- SuiteApiResolver<TestSuite>::GetSetUpCaseOrSuite(),
- SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(),
+ SuiteApiResolver<TestSuite>::GetSetUpCaseOrSuite(file, line),
+ SuiteApiResolver<TestSuite>::GetTearDownCaseOrSuite(file, line),
test_info->test_meta_factory->CreateTestFactory(*param_it));
} // for param_it
} // for gen_it