diff options
Diffstat (limited to 'include/gtest/gtest-test-part.h')
-rw-r--r-- | include/gtest/gtest-test-part.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h index 14d8e7b..58e7df9 100644 --- a/include/gtest/gtest-test-part.h +++ b/include/gtest/gtest-test-part.h @@ -39,27 +39,24 @@ namespace testing { -// The possible outcomes of a test part (i.e. an assertion or an -// explicit SUCCEED(), FAIL(), or ADD_FAILURE()). -// TODO(vladl@google.com): Rename the enum values to kSuccess, -// kNonFatalFailure, and kFatalFailure before publishing the event listener -// API (see issue http://code.google.com/p/googletest/issues/detail?id=165). -enum TestPartResultType { - TPRT_SUCCESS, // Succeeded. - TPRT_NONFATAL_FAILURE, // Failed but the test can continue. - TPRT_FATAL_FAILURE // Failed and the test should be terminated. -}; - // A copyable object representing the result of a test part (i.e. an // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()). // // Don't inherit from TestPartResult as its destructor is not virtual. class TestPartResult { public: + // The possible outcomes of a test part (i.e. an assertion or an + // explicit SUCCEED(), FAIL(), or ADD_FAILURE()). + enum Type { + kSuccess, // Succeeded. + kNonFatalFailure, // Failed but the test can continue. + kFatalFailure // Failed and the test should be terminated. + }; + // C'tor. TestPartResult does NOT have a default constructor. // Always use this constructor (with parameters) to create a // TestPartResult object. - TestPartResult(TestPartResultType type, + TestPartResult(Type type, const char* file_name, int line_number, const char* message) @@ -71,7 +68,7 @@ class TestPartResult { } // Gets the outcome of the test part. - TestPartResultType type() const { return type_; } + Type type() const { return type_; } // Gets the name of the source file where the test part took place, or // NULL if it's unknown. @@ -88,18 +85,18 @@ class TestPartResult { const char* message() const { return message_.c_str(); } // Returns true iff the test part passed. - bool passed() const { return type_ == TPRT_SUCCESS; } + bool passed() const { return type_ == kSuccess; } // Returns true iff the test part failed. - bool failed() const { return type_ != TPRT_SUCCESS; } + bool failed() const { return type_ != kSuccess; } // Returns true iff the test part non-fatally failed. - bool nonfatally_failed() const { return type_ == TPRT_NONFATAL_FAILURE; } + bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. - bool fatally_failed() const { return type_ == TPRT_FATAL_FAILURE; } + bool fatally_failed() const { return type_ == kFatalFailure; } private: - TestPartResultType type_; + Type type_; // Gets the summary of the failure message by omitting the stack // trace in it. |