aboutsummaryrefslogtreecommitdiffstats
path: root/test/gmock-actions_test.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-02-28 22:58:51 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-02-28 22:58:51 +0000
commitedd4ab4945aeacdf9bd5ec3ac1654b940ca72532 (patch)
tree2f79533f5eeeb885491b8b4b707d44096e934f7c /test/gmock-actions_test.cc
parentcf40604cf087eb2a616f104fac587bd889b24e5d (diff)
downloadgoogletest-edd4ab4945aeacdf9bd5ec3ac1654b940ca72532.tar.gz
googletest-edd4ab4945aeacdf9bd5ec3ac1654b940ca72532.tar.bz2
googletest-edd4ab4945aeacdf9bd5ec3ac1654b940ca72532.zip
Makes googlemock throw a runtime_error instead of abort when a mock
method with no default value is invoked (if exceptions are enabled).
Diffstat (limited to 'test/gmock-actions_test.cc')
-rw-r--r--test/gmock-actions_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc
index fd87c74c..1210d464 100644
--- a/test/gmock-actions_test.cc
+++ b/test/gmock-actions_test.cc
@@ -634,15 +634,19 @@ TEST(DoDefaultTest, ReturnsBuiltInDefaultValueByDefault) {
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