summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/internal/gtest-internal.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2019-11-01 10:28:59 (GMT)
committerGennadiy Civil <misterg@google.com>2019-11-18 15:39:32 (GMT)
commit0f0634a66e95ae64d769171a0a96b87e60dfa207 (patch)
treeb334848bedc3d4a3d55a62f3a93009b9fe73c809 /googletest/include/gtest/internal/gtest-internal.h
parentc27acebba3b3c7d94209e0467b0a801db4af73ed (diff)
downloadgoogletest-0f0634a66e95ae64d769171a0a96b87e60dfa207.zip
googletest-0f0634a66e95ae64d769171a0a96b87e60dfa207.tar.gz
googletest-0f0634a66e95ae64d769171a0a96b87e60dfa207.tar.bz2
- 277898422 BEGIN_PUBLIC by Abseil Team <absl-team@google.com> PiperOrigin-RevId: 277898422
Diffstat (limited to 'googletest/include/gtest/internal/gtest-internal.h')
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h36
1 files changed, 3 insertions, 33 deletions
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index f9da489..edf0afa 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -825,16 +825,6 @@ struct GTEST_API_ ConstCharPtr {
const char* value;
};
-// Helper for declaring std::string within 'if' statement
-// in pre C++17 build environment.
-struct GTEST_API_ TrueWithString {
- TrueWithString() = default;
- explicit TrueWithString(const char* str) : value(str) {}
- explicit TrueWithString(const std::string& str) : value(str) {}
- explicit operator bool() const { return true; }
- std::string value;
-};
-
// A simple Linear Congruential Generator for generating random
// numbers with a uniform distribution. Unlike rand() and srand(), it
// doesn't use global state (and therefore can't interfere with user
@@ -1294,39 +1284,19 @@ constexpr bool InstantiateTypedTestCase_P_IsDeprecated() { return true; }
GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \
fail(gtest_msg.value)
-#if GTEST_HAS_EXCEPTIONS
-
-#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
- catch (std::exception const& e) { \
- gtest_msg.value = ( \
- "it throws std::exception-derived exception with description: \"" \
- ); \
- gtest_msg.value += e.what(); \
- gtest_msg.value += "\"."; \
- goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
- }
-
-#else // GTEST_HAS_EXCEPTIONS
-
-#define GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_()
-
-#endif // GTEST_HAS_EXCEPTIONS
-
#define GTEST_TEST_NO_THROW_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
- if (::testing::internal::TrueWithString gtest_msg{}) { \
+ if (::testing::internal::AlwaysTrue()) { \
try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} \
- GTEST_TEST_NO_THROW_CATCH_STD_EXCEPTION_() \
catch (...) { \
- gtest_msg.value = "it throws."; \
goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \
} \
} else \
GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \
- fail(("Expected: " #statement " doesn't throw an exception.\n" \
- " Actual: " + gtest_msg.value).c_str())
+ fail("Expected: " #statement " doesn't throw an exception.\n" \
+ " Actual: it throws.")
#define GTEST_TEST_ANY_THROW_(statement, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \