diff options
Diffstat (limited to 'include/gtest/internal/gtest-internal.h')
-rw-r--r-- | include/gtest/internal/gtest-internal.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index ca4e1fdb..892ddecd 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -46,6 +46,10 @@ # include <unistd.h> #endif // GTEST_OS_LINUX +#if GTEST_HAS_EXCEPTIONS +# include <stdexcept> +#endif + #include <ctype.h> #include <string.h> #include <iomanip> @@ -166,6 +170,21 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT GTEST_API_ std::string AppendUserMessage( const std::string& gtest_msg, const Message& user_msg); +#if GTEST_HAS_EXCEPTIONS + +// This exception is thrown by (and only by) a failed Google Test +// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions +// are enabled). We derive it from std::runtime_error, which is for +// errors presumably detectable only at run time. Since +// std::runtime_error inherits from std::exception, many testing +// frameworks know how to extract and print the message inside it. +class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error { + public: + explicit GoogleTestFailureException(const TestPartResult& failure); +}; + +#endif // GTEST_HAS_EXCEPTIONS + // A helper class for creating scoped traces in user programs. class GTEST_API_ ScopedTrace { public: |