Makes googlemock throw a runtime_error instead of abort when a mock
method with no default value is invoked (if exceptions are enabled).
diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc
index fd87c74..1210d46 100644
--- a/test/gmock-actions_test.cc
+++ b/test/gmock-actions_test.cc
@@ -634,15 +634,19 @@
EXPECT_EQ(0, mock.IntFunc(true));
}
-// Tests that DoDefault() aborts the process when there is no built-in
-// default value for the return type.
+// Tests that DoDefault() throws (when exceptions are enabled) or aborts
+// the process when there is no built-in default value for the return type.
TEST(DoDefaultDeathTest, DiesForUnknowType) {
MockClass mock;
EXPECT_CALL(mock, Foo())
.WillRepeatedly(DoDefault());
+#if GTEST_HAS_EXCEPTIONS
+ EXPECT_ANY_THROW(mock.Foo());
+#else
EXPECT_DEATH_IF_SUPPORTED({
mock.Foo();
}, "");
+#endif
}
// Tests that using DoDefault() inside a composite action leads to a