aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtest-internal-inl.h
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-07-16 00:36:55 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-07-16 00:36:55 +0000
commitc214ebc830aa918d54e535c6caa2da6317877e12 (patch)
treef8b2283ea725ae5686723c331341f7f20e375153 /src/gtest-internal-inl.h
parent3a47ddf8ea888b4e5fe06bf79ef03a1456274f00 (diff)
downloadgoogletest-c214ebc830aa918d54e535c6caa2da6317877e12.tar.gz
googletest-c214ebc830aa918d54e535c6caa2da6317877e12.tar.bz2
googletest-c214ebc830aa918d54e535c6caa2da6317877e12.zip
More refactoring for the event listener API, by Vlad Losev.
Diffstat (limited to 'src/gtest-internal-inl.h')
-rw-r--r--src/gtest-internal-inl.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index 92975dd0..5bb981d2 100644
--- a/src/gtest-internal-inl.h
+++ b/src/gtest-internal-inl.h
@@ -483,8 +483,8 @@ class TestInfoImpl {
TypeId fixture_class_id() const { return fixture_class_id_; }
// Returns the test result.
- internal::TestResult* result() { return &result_; }
- const internal::TestResult* result() const { return &result_; }
+ TestResult* result() { return &result_; }
+ const TestResult* result() const { return &result_; }
// Creates the test object, runs it, records its result, and then
// deletes it.
@@ -520,7 +520,7 @@ class TestInfoImpl {
// This field is mutable and needs to be reset before running the
// test for the second time.
- internal::TestResult result_;
+ TestResult result_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfoImpl);
};
@@ -742,19 +742,17 @@ class UnitTestImpl {
// Returns the TestResult for the test that's currently running, or
// the TestResult for the ad hoc test if no test is running.
- internal::TestResult* current_test_result();
+ TestResult* current_test_result();
// Returns the TestResult for the ad hoc test.
- const internal::TestResult* ad_hoc_test_result() const {
- return &ad_hoc_test_result_;
- }
+ const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
// Sets the unit test result printer.
//
// Does nothing if the input and the current printer object are the
// same; otherwise, deletes the old printer object and makes the
// input the current printer.
- void set_result_printer(UnitTestEventListenerInterface * result_printer);
+ void set_result_printer(UnitTestEventListenerInterface* result_printer);
// Returns the current unit test result printer if it is not NULL;
// otherwise, creates an appropriate result printer, makes it the
@@ -991,7 +989,7 @@ class UnitTestImpl {
// If an assertion is encountered when no TEST or TEST_F is running,
// Google Test attributes the assertion result to an imaginary "ad hoc"
// test, and records the result in ad_hoc_test_result_.
- internal::TestResult ad_hoc_test_result_;
+ TestResult ad_hoc_test_result_;
// The unit test result printer. Will be deleted when the UnitTest
// object is destructed. By default, a plain text printer is used,
@@ -1122,6 +1120,28 @@ bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
}
#endif // GTEST_HAS_DEATH_TEST
+// TestResult contains some private methods that should be hidden from
+// Google Test user but are required for testing. This class allow our tests
+// to access them.
+class TestResultAccessor {
+ public:
+ static void RecordProperty(TestResult* test_result,
+ const TestProperty& property) {
+ test_result->RecordProperty(property);
+ }
+
+ static bool Passed(const TestResult& result) { return result.Passed(); }
+
+ static void ClearTestPartResults(TestResult* test_result) {
+ test_result->ClearTestPartResults();
+ }
+
+ static const Vector<testing::TestPartResult>& test_part_results(
+ const TestResult& test_result) {
+ return test_result.test_part_results();
+ }
+};
+
} // namespace internal
} // namespace testing