36 #if GTEST_HAS_EXCEPTIONS
39 using testing::HasSubstr;
41 using testing::internal::GoogleTestFailureException;
44 class NonDefaultConstructible {
46 explicit NonDefaultConstructible(
int ) {}
53 MOCK_METHOD0(GetNonDefaultConstructible, NonDefaultConstructible());
56 TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
64 mock.GetNonDefaultConstructible();
65 FAIL() <<
"GetNonDefaultConstructible()'s return type has no default "
66 <<
"value, so Google Mock should have thrown.";
67 }
catch (
const GoogleTestFailureException& ) {
68 FAIL() <<
"Google Test does not try to catch an exception of type "
69 <<
"GoogleTestFailureException, which is used for reporting "
70 <<
"a failure to other testing frameworks. Google Mock should "
71 <<
"not throw a GoogleTestFailureException as it will kill the "
72 <<
"entire test program instead of just the current TEST.";
73 }
catch (
const std::exception& ex) {
74 EXPECT_THAT(ex.what(), HasSubstr(
"has no default value"));
#define MOCK_METHOD0(m,...)
#define TEST(test_suite_name, test_name)
#define EXPECT_THAT(value, matcher)