diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-07-26 21:59:50 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-07-26 21:59:50 +0000 |
commit | 7c598c4f1a44fdda5f97587484c85bef9e93fa98 (patch) | |
tree | a393db9c0cebf32d9a62a2a95e8ade4f5750c62c /include | |
parent | 598fe2288e8e102d6e6748d496a8dcd59fa5f8a8 (diff) | |
download | googletest-7c598c4f1a44fdda5f97587484c85bef9e93fa98.tar.gz googletest-7c598c4f1a44fdda5f97587484c85bef9e93fa98.tar.bz2 googletest-7c598c4f1a44fdda5f97587484c85bef9e93fa98.zip |
Adds ADD_FAILURE_AT (by Zhanyong Wan); disables -Wswitch-default (by Vlad Losev).
Diffstat (limited to 'include')
-rw-r--r-- | include/gtest/gtest.h | 6 | ||||
-rw-r--r-- | include/gtest/internal/gtest-internal.h | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h index 90dde389..af9d9e7c 100644 --- a/include/gtest/gtest.h +++ b/include/gtest/gtest.h @@ -1627,6 +1627,12 @@ const T* TestWithParam<T>::parameter_ = NULL; // Generates a nonfatal failure with a generic message. #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_("Failed") +// Generates a nonfatal failure at the given source file location with +// a generic message. +#define ADD_FAILURE_AT(file, line) \ + GTEST_MESSAGE_AT_(file, line, "Failed", \ + ::testing::TestPartResult::kNonFatalFailure) + // Generates a fatal failure with a generic message. #define GTEST_FAIL() GTEST_FATAL_FAILURE_("Failed") diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 4a20c53c..1e453df6 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -1064,10 +1064,13 @@ class NativeArray { } // namespace internal } // namespace testing -#define GTEST_MESSAGE_(message, result_type) \ - ::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \ +#define GTEST_MESSAGE_AT_(file, line, message, result_type) \ + ::testing::internal::AssertHelper(result_type, file, line, message) \ = ::testing::Message() +#define GTEST_MESSAGE_(message, result_type) \ + GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type) + #define GTEST_FATAL_FAILURE_(message) \ return GTEST_MESSAGE_(message, ::testing::TestPartResult::kFatalFailure) |