proxygen
testing::gmock_nice_strict_test Namespace Reference

Classes

class  Foo
 
class  MockBar
 
class  MockFoo
 

Functions

 TEST (NiceMockTest, AllowsExpectedCall)
 
 TEST (NiceMockTest, UnexpectedCallFails)
 
 TEST (NiceMockTest, NonDefaultConstructor)
 
 TEST (NiceMockTest, NonDefaultConstructor10)
 
 TEST (NiceMockTest, AcceptsClassNamedMock)
 
 TEST (NaggyMockTest, AllowsExpectedCall)
 
 TEST (NaggyMockTest, UnexpectedCallFails)
 
 TEST (NaggyMockTest, NonDefaultConstructor)
 
 TEST (NaggyMockTest, NonDefaultConstructor10)
 
 TEST (NaggyMockTest, AcceptsClassNamedMock)
 
 TEST (StrictMockTest, AllowsExpectedCall)
 
 TEST (StrictMockTest, UnexpectedCallFails)
 
 TEST (StrictMockTest, UninterestingCallFails)
 
 TEST (StrictMockTest, UninterestingCallFailsAfterDeath)
 
 TEST (StrictMockTest, NonDefaultConstructor)
 
 TEST (StrictMockTest, NonDefaultConstructor10)
 
 TEST (StrictMockTest, AcceptsClassNamedMock)
 

Function Documentation

testing::gmock_nice_strict_test::TEST ( NiceMockTest  ,
AllowsExpectedCall   
)

Definition at line 204 of file gmock-nice-strict_test.cc.

References EXPECT_CALL.

204  {
205  NiceMock<MockFoo> nice_foo;
206 
207  EXPECT_CALL(nice_foo, DoThis());
208  nice_foo.DoThis();
209 }
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( NiceMockTest  ,
UnexpectedCallFails   
)

Definition at line 212 of file gmock-nice-strict_test.cc.

References EXPECT_CALL, and EXPECT_NONFATAL_FAILURE.

212  {
213  NiceMock<MockFoo> nice_foo;
214 
215  EXPECT_CALL(nice_foo, DoThis()).Times(0);
216  EXPECT_NONFATAL_FAILURE(nice_foo.DoThis(), "called more times than expected");
217 }
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( NiceMockTest  ,
NonDefaultConstructor   
)

Definition at line 221 of file gmock-nice-strict_test.cc.

References EXPECT_EQ.

221  {
222  NiceMock<MockBar> nice_bar("hi");
223  EXPECT_EQ("hi", nice_bar.str());
224 
225  nice_bar.This();
226  nice_bar.That(5, true);
227 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gmock_nice_strict_test::TEST ( NiceMockTest  ,
NonDefaultConstructor10   
)

Definition at line 231 of file gmock-nice-strict_test.cc.

References EXPECT_EQ.

231  {
232  NiceMock<MockBar> nice_bar('a', 'b', "c", "d", 'e', 'f',
233  "g", "h", true, false);
234  EXPECT_EQ("abcdefghTF", nice_bar.str());
235 
236  nice_bar.This();
237  nice_bar.That(5, true);
238 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gmock_nice_strict_test::TEST ( NiceMockTest  ,
AcceptsClassNamedMock   
)

Definition at line 249 of file gmock-nice-strict_test.cc.

References testing::internal::CaptureStdout(), testing::internal::Delete(), EXPECT_CALL, EXPECT_THAT, testing::internal::GetCapturedStdout(), GMOCK_FLAG, testing::HasSubstr(), testing::Invoke(), ON_CALL, and TEST().

249  {
250  NiceMock< ::Mock> nice;
251  EXPECT_CALL(nice, DoThis());
252  nice.DoThis();
253 }
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( NaggyMockTest  ,
AllowsExpectedCall   
)

Definition at line 296 of file gmock-nice-strict_test.cc.

References EXPECT_CALL.

296  {
297  NaggyMock<MockFoo> naggy_foo;
298 
299  EXPECT_CALL(naggy_foo, DoThis());
300  naggy_foo.DoThis();
301 }
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( NaggyMockTest  ,
UnexpectedCallFails   
)

Definition at line 304 of file gmock-nice-strict_test.cc.

References EXPECT_CALL, and EXPECT_NONFATAL_FAILURE.

304  {
305  NaggyMock<MockFoo> naggy_foo;
306 
307  EXPECT_CALL(naggy_foo, DoThis()).Times(0);
308  EXPECT_NONFATAL_FAILURE(naggy_foo.DoThis(),
309  "called more times than expected");
310 }
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( NaggyMockTest  ,
NonDefaultConstructor   
)

Definition at line 314 of file gmock-nice-strict_test.cc.

References EXPECT_EQ.

314  {
315  NaggyMock<MockBar> naggy_bar("hi");
316  EXPECT_EQ("hi", naggy_bar.str());
317 
318  naggy_bar.This();
319  naggy_bar.That(5, true);
320 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gmock_nice_strict_test::TEST ( NaggyMockTest  ,
NonDefaultConstructor10   
)

Definition at line 324 of file gmock-nice-strict_test.cc.

References EXPECT_EQ.

324  {
325  NaggyMock<MockBar> naggy_bar('0', '1', "2", "3", '4', '5',
326  "6", "7", true, false);
327  EXPECT_EQ("01234567TF", naggy_bar.str());
328 
329  naggy_bar.This();
330  naggy_bar.That(5, true);
331 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
testing::gmock_nice_strict_test::TEST ( NaggyMockTest  ,
AcceptsClassNamedMock   
)

Definition at line 342 of file gmock-nice-strict_test.cc.

References EXPECT_CALL.

342  {
343  NaggyMock< ::Mock> naggy;
344  EXPECT_CALL(naggy, DoThis());
345  naggy.DoThis();
346 }
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
AllowsExpectedCall   
)

Definition at line 350 of file gmock-nice-strict_test.cc.

References EXPECT_CALL.

350  {
351  StrictMock<MockFoo> strict_foo;
352 
353  EXPECT_CALL(strict_foo, DoThis());
354  strict_foo.DoThis();
355 }
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
UnexpectedCallFails   
)

Definition at line 358 of file gmock-nice-strict_test.cc.

References EXPECT_CALL, and EXPECT_NONFATAL_FAILURE.

358  {
359  StrictMock<MockFoo> strict_foo;
360 
361  EXPECT_CALL(strict_foo, DoThis()).Times(0);
362  EXPECT_NONFATAL_FAILURE(strict_foo.DoThis(),
363  "called more times than expected");
364 }
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
#define EXPECT_CALL(obj, call)
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
UninterestingCallFails   
)

Definition at line 367 of file gmock-nice-strict_test.cc.

References EXPECT_NONFATAL_FAILURE.

367  {
368  StrictMock<MockFoo> strict_foo;
369 
370  EXPECT_NONFATAL_FAILURE(strict_foo.DoThis(),
371  "Uninteresting mock function call");
372 }
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
UninterestingCallFailsAfterDeath   
)

Definition at line 376 of file gmock-nice-strict_test.cc.

References testing::internal::Delete(), EXPECT_NONFATAL_FAILURE, testing::Invoke(), and ON_CALL.

376  {
377  StrictMock<MockFoo>* const strict_foo = new StrictMock<MockFoo>;
378 
379  ON_CALL(*strict_foo, DoThis())
380  .WillByDefault(Invoke(strict_foo, &MockFoo::Delete));
381 
382  EXPECT_NONFATAL_FAILURE(strict_foo->DoThis(),
383  "Uninteresting mock function call");
384 }
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
#define ON_CALL(obj, call)
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
static void Delete(T *x)
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
NonDefaultConstructor   
)

Definition at line 388 of file gmock-nice-strict_test.cc.

References EXPECT_EQ, and EXPECT_NONFATAL_FAILURE.

388  {
389  StrictMock<MockBar> strict_bar("hi");
390  EXPECT_EQ("hi", strict_bar.str());
391 
392  EXPECT_NONFATAL_FAILURE(strict_bar.That(5, true),
393  "Uninteresting mock function call");
394 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
NonDefaultConstructor10   
)

Definition at line 398 of file gmock-nice-strict_test.cc.

References EXPECT_EQ, and EXPECT_NONFATAL_FAILURE.

398  {
399  StrictMock<MockBar> strict_bar('a', 'b', "c", "d", 'e', 'f',
400  "g", "h", true, false);
401  EXPECT_EQ("abcdefghTF", strict_bar.str());
402 
403  EXPECT_NONFATAL_FAILURE(strict_bar.That(5, true),
404  "Uninteresting mock function call");
405 }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition: gtest-spi.h:204
testing::gmock_nice_strict_test::TEST ( StrictMockTest  ,
AcceptsClassNamedMock   
)

Definition at line 416 of file gmock-nice-strict_test.cc.

References EXPECT_CALL.

Referenced by testing::gmock_nice_strict_test::MockBar::str(), and TEST().

416  {
417  StrictMock< ::Mock> strict;
418  EXPECT_CALL(strict, DoThis());
419  strict.DoThis();
420 }
#define EXPECT_CALL(obj, call)