From 758283f7d9453e0b4e42abb20c561f43a53c742a Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 5 May 2014 08:19:35 -0700 Subject: [PATCH] Fix tests. --- test/gtest-extra-test.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index 79150346..2445582c 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -33,6 +33,10 @@ #include #include +#ifdef _WIN32 +# include // for _CrtSetReportMode +#endif // _WIN32 + namespace { std::string FormatSystemErrorMessage(int error_code, fmt::StringRef message) { @@ -99,7 +103,7 @@ void ThrowException() { // Tests that when EXPECT_THROW_MSG fails, it evaluates its message argument // exactly once. -TEST_F(SingleEvaluationTest, FailedASSERT_THROW_MSG) { +TEST_F(SingleEvaluationTest, FailedEXPECT_THROW_MSG) { EXPECT_NONFATAL_FAILURE( EXPECT_THROW_MSG(ThrowException(), std::exception, p_++), "01234"); EXPECT_EQ(s_ + 1, p_); @@ -193,16 +197,19 @@ class BufferedFileTest : public ::testing::Test { #ifdef _WIN32 private: _invalid_parameter_handler original_handler_; + int original_report_mode_; static void InvalidParameterHandler(const wchar_t *, const wchar_t *, const wchar_t *, unsigned , uintptr_t) {} public: BufferedFileTest() - : original_handler_(_set_invalid_parameter_handler(InvalidParameterHandler)) { + : original_handler_(_set_invalid_parameter_handler(InvalidParameterHandler)), + original_report_mode_(_CrtSetReportMode(_CRT_ASSERT, 0)) { } ~BufferedFileTest() { _set_invalid_parameter_handler(original_handler_); + _CrtSetReportMode(_CRT_ASSERT, original_report_mode_); } #endif // _WIN32 };