53 namespace gmock_nice_strict_test {
 
   55 using testing::HasSubstr;
 
   60 #if GTEST_HAS_STREAM_REDIRECTION 
   81   virtual ~Foo() = 
default;
 
   84   virtual int DoThat(
bool flag) = 0;
 
  105   MockBar(
char a1, 
char a2, std::string a3, std::string a4, 
int a5, 
int a6,
 
  106           const std::string& a7, 
const std::string& a8, 
bool a9, 
bool a10) {
 
  107     str_ = std::string() + a1 + a2 + a3 + a4 + 
static_cast<char>(a5) +
 
  108            static_cast<char>(a6) + a7 + a8 + (a9 ? 
'T' : 
'F') +
 
  114   const std::string& 
str()
 const { 
return str_; }
 
  142 #if GTEST_HAS_STREAM_REDIRECTION 
  145 TEST(RawMockTest, WarningForUninterestingCall) {
 
  153   raw_foo.DoThat(
true);
 
  155               HasSubstr(
"Uninteresting mock function call"));
 
  162 TEST(RawMockTest, WarningForUninterestingCallAfterDeath) {
 
  166   MockFoo* 
const raw_foo = 
new MockFoo;
 
  173               HasSubstr(
"Uninteresting mock function call"));
 
  180 TEST(RawMockTest, InfoForUninterestingCall) {
 
  188               HasSubstr(
"Uninteresting mock function call"));
 
  193 TEST(RawMockTest, IsNaggy_IsNice_IsStrict) {
 
  201 TEST(NiceMockTest, NoWarningForUninterestingCall) {
 
  202   NiceMock<MockFoo> nice_foo;
 
  206   nice_foo.DoThat(
true);
 
  212 TEST(NiceMockTest, NoWarningForUninterestingCallAfterDeath) {
 
  213   NiceMock<MockFoo>* 
const nice_foo = 
new NiceMock<MockFoo>;
 
  225 TEST(NiceMockTest, InfoForUninterestingCall) {
 
  226   NiceMock<MockFoo> nice_foo;
 
  233               HasSubstr(
"Uninteresting mock function call"));
 
  238 #endif  // GTEST_HAS_STREAM_REDIRECTION 
  241 TEST(NiceMockTest, AllowsExpectedCall) {
 
  251 TEST(NiceMockTest, ThrowsExceptionForUnknownReturnTypes) {
 
  253 #if GTEST_HAS_EXCEPTIONS 
  255     nice_foo.ReturnNonDefaultConstructible();
 
  257   } 
catch (
const std::runtime_error& ex) {
 
  258     EXPECT_THAT(ex.what(), HasSubstr(
"ReturnNonDefaultConstructible"));
 
  266 TEST(NiceMockTest, UnexpectedCallFails) {
 
  275 TEST(NiceMockTest, NonDefaultConstructor) {
 
  280   nice_bar.That(5, 
true);
 
  285 TEST(NiceMockTest, NonDefaultConstructor10) {
 
  291   nice_bar.That(5, 
true);
 
  294 TEST(NiceMockTest, AllowLeak) {
 
  296   Mock::AllowLeak(leaked);
 
  301 TEST(NiceMockTest, MoveOnlyConstructor) {
 
  307 TEST(NiceMockTest, AcceptsClassNamedMock) {
 
  313 TEST(NiceMockTest, IsNiceInDestructor) {
 
  320 TEST(NiceMockTest, IsNaggy_IsNice_IsStrict) {
 
  327 #if GTEST_HAS_STREAM_REDIRECTION 
  330 TEST(NaggyMockTest, WarningForUninterestingCall) {
 
  338   naggy_foo.DoThat(
true);
 
  340               HasSubstr(
"Uninteresting mock function call"));
 
  347 TEST(NaggyMockTest, WarningForUninterestingCallAfterDeath) {
 
  351   NaggyMock<MockFoo>* 
const naggy_foo = 
new NaggyMock<MockFoo>;
 
  359               HasSubstr(
"Uninteresting mock function call"));
 
  364 #endif  // GTEST_HAS_STREAM_REDIRECTION 
  367 TEST(NaggyMockTest, AllowsExpectedCall) {
 
  375 TEST(NaggyMockTest, UnexpectedCallFails) {
 
  380                           "called more times than expected");
 
  385 TEST(NaggyMockTest, NonDefaultConstructor) {
 
  390   naggy_bar.That(5, 
true);
 
  395 TEST(NaggyMockTest, NonDefaultConstructor10) {
 
  398   EXPECT_EQ(
"01234567TF", naggy_bar.str());
 
  401   naggy_bar.That(5, 
true);
 
  404 TEST(NaggyMockTest, AllowLeak) {
 
  406   Mock::AllowLeak(leaked);
 
  411 TEST(NaggyMockTest, MoveOnlyConstructor) {
 
  417 TEST(NaggyMockTest, AcceptsClassNamedMock) {
 
  423 TEST(NaggyMockTest, IsNaggyInDestructor) {
 
  434               HasSubstr(
"Uninteresting mock function call"));
 
  439 TEST(NaggyMockTest, IsNaggy_IsNice_IsStrict) {
 
  447 TEST(StrictMockTest, AllowsExpectedCall) {
 
  455 TEST(StrictMockTest, UnexpectedCallFails) {
 
  460                           "called more times than expected");
 
  464 TEST(StrictMockTest, UninterestingCallFails) {
 
  468                           "Uninteresting mock function call");
 
  473 TEST(StrictMockTest, UninterestingCallFailsAfterDeath) {
 
  480                           "Uninteresting mock function call");
 
  485 TEST(StrictMockTest, NonDefaultConstructor) {
 
  490                           "Uninteresting mock function call");
 
  495 TEST(StrictMockTest, NonDefaultConstructor10) {
 
  498   EXPECT_EQ(
"abcdefghTF", strict_bar.str());
 
  501                           "Uninteresting mock function call");
 
  504 TEST(StrictMockTest, AllowLeak) {
 
  506   Mock::AllowLeak(leaked);
 
  511 TEST(StrictMockTest, MoveOnlyConstructor) {
 
  517 TEST(StrictMockTest, AcceptsClassNamedMock) {
 
  523 TEST(StrictMockTest, IsStrictInDestructor) {
 
  530       "Uninteresting mock function call");
 
  533 TEST(StrictMockTest, IsNaggy_IsNice_IsStrict) {
 
MOCK_METHOD0(This, int())
 
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
 
GTEST_API_ std::string GetCapturedStdout()
 
#define EXPECT_NONFATAL_FAILURE(statement, substr)
 
TEST(NiceMockTest, AllowsExpectedCall)
 
MOCK_METHOD0(DoThis, void())
 
MockBar(char a1, char a2, std::string a3, std::string a4, int a5, int a6, const std::string &a7, const std::string &a8, bool a9, bool a10)
 
MockFoo & operator=(const MockFoo &)=delete
 
#define ON_CALL(obj, call)
 
NotDefaultConstructible(int)
 
GTEST_API_ void CaptureStdout()
 
std::decay< FunctionImpl >::type Invoke(FunctionImpl &&function_impl)
 
#define GMOCK_FLAG_GET(name)
 
MoveOnly & operator=(const MoveOnly &)=delete
 
#define GMOCK_FLAG_SET(name, value)
 
const std::string & str() const 
 
#define EXPECT_THAT(value, matcher)
 
MOCK_METHOD0(DoThis, void())
 
#define EXPECT_CALL(obj, call)
 
#define EXPECT_EQ(val1, val2)
 
~CallsMockMethodInDestructor()
 
Mock & operator=(const Mock &)=delete
 
virtual ~MockBar()=default
 
MOCK_METHOD(void, OnDestroy,())
 
#define EXPECT_TRUE(condition)
 
MockBar(const std::string &s)
 
MOCK_METHOD1(DoThat, int(bool flag))
 
MOCK_METHOD2(That, std::string(int, bool))
 
#define EXPECT_FALSE(condition)
 
MockBar & operator=(const MockBar &)=delete
 
virtual int DoThat(bool flag)=0