From 93bfdde0eeac83fb51b856dc4dc9c38c408b0ee0 Mon Sep 17 00:00:00 2001 From: Adrian Moran Date: Wed, 11 Jul 2018 14:59:01 +0200 Subject: [PATCH 1/3] Fix issue #1654. Signed-off-by: Adrian Moran --- googlemock/test/gmock_ex_test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/googlemock/test/gmock_ex_test.cc b/googlemock/test/gmock_ex_test.cc index 3afed86a..8c83890f 100644 --- a/googlemock/test/gmock_ex_test.cc +++ b/googlemock/test/gmock_ex_test.cc @@ -37,7 +37,9 @@ namespace { using testing::HasSubstr; +#if GTEST_HAS_EXCEPTIONS using testing::internal::GoogleTestFailureException; +#endif // A type that cannot be default constructed. class NonDefaultConstructible { From 0acdf796420e4562ef7399b8610d23eda3256a5a Mon Sep 17 00:00:00 2001 From: Adrian Moran Date: Thu, 12 Jul 2018 15:10:08 +0200 Subject: [PATCH 2/3] Avoid full test in no exceptions are enabled. Signed-off-by: Adrian Moran --- googlemock/test/gmock_ex_test.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/googlemock/test/gmock_ex_test.cc b/googlemock/test/gmock_ex_test.cc index 8c83890f..5a299dae 100644 --- a/googlemock/test/gmock_ex_test.cc +++ b/googlemock/test/gmock_ex_test.cc @@ -31,15 +31,14 @@ // Tests Google Mock's functionality that depends on exceptions. +#if GTEST_HAS_EXCEPTIONS #include "gmock/gmock.h" #include "gtest/gtest.h" namespace { using testing::HasSubstr; -#if GTEST_HAS_EXCEPTIONS using testing::internal::GoogleTestFailureException; -#endif // A type that cannot be default constructed. class NonDefaultConstructible { @@ -54,7 +53,6 @@ class MockFoo { MOCK_METHOD0(GetNonDefaultConstructible, NonDefaultConstructible()); }; -#if GTEST_HAS_EXCEPTIONS TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) { MockFoo mock; @@ -78,6 +76,5 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) { } } -#endif - } // unnamed namespace +#endif From cbd07191f4b7a3498fd0d1d7c58c4c39cccb8fb8 Mon Sep 17 00:00:00 2001 From: Adrian Moran Date: Fri, 13 Jul 2018 08:53:03 +0200 Subject: [PATCH 3/3] Put ifdef guard after the includes. Signed-off-by: Adrian Moran --- googlemock/test/gmock_ex_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/test/gmock_ex_test.cc b/googlemock/test/gmock_ex_test.cc index 5a299dae..99268b31 100644 --- a/googlemock/test/gmock_ex_test.cc +++ b/googlemock/test/gmock_ex_test.cc @@ -31,10 +31,10 @@ // Tests Google Mock's functionality that depends on exceptions. -#if GTEST_HAS_EXCEPTIONS #include "gmock/gmock.h" #include "gtest/gtest.h" +#if GTEST_HAS_EXCEPTIONS namespace { using testing::HasSubstr;