Lines Matching +full:mock +full:- +full:tests
30 #include "gmock/gmock-nice-strict.h"
36 #include "gtest/gtest-spi.h"
40 // clash with ::testing::Mock.
41 class Mock { class
43 Mock() = default;
48 Mock(const Mock&) = delete;
49 Mock& operator=(const Mock&) = delete;
77 // Defines some mock classes needed by the tests.
144 // Tests that a raw mock generates warnings for uninteresting calls.
155 HasSubstr("Uninteresting mock function call")); in TEST()
160 // Tests that a raw mock generates warnings for uninteresting calls
161 // that delete the mock object.
171 raw_foo->DoThis(); in TEST()
173 HasSubstr("Uninteresting mock function call")); in TEST()
178 // Tests that a raw mock generates informational logs for
188 HasSubstr("Uninteresting mock function call")); in TEST()
195 EXPECT_TRUE(Mock::IsNaggy(&raw_foo)); in TEST()
196 EXPECT_FALSE(Mock::IsNice(&raw_foo)); in TEST()
197 EXPECT_FALSE(Mock::IsStrict(&raw_foo)); in TEST()
200 // Tests that a nice mock generates no warning for uninteresting calls.
210 // Tests that a nice mock generates no warning for uninteresting calls
211 // that delete the mock object.
219 nice_foo->DoThis(); in TEST()
223 // Tests that a nice mock generates informational logs for
233 HasSubstr("Uninteresting mock function call")); in TEST()
240 // Tests that a nice mock allows expected calls.
248 // Tests that an unexpected call on a nice mock which returns a
249 // not-default-constructible type throws an exception and the exception contains
265 // Tests that an unexpected call on a nice mock fails.
273 // Tests that NiceMock works with a mock class that has a non-default
283 // Tests that NiceMock works with a mock class that has a 10-ary
284 // non-default constructor.
296 Mock::AllowLeak(leaked); in TEST()
298 leaked->DoThis(); in TEST()
305 // Tests that NiceMock<Mock> compiles where Mock is a user-defined
306 // class (as opposed to ::testing::Mock).
308 NiceMock< ::Mock> nice; in TEST()
316 // Don't add an expectation for the call before the mock goes out of scope. in TEST()
322 EXPECT_FALSE(Mock::IsNaggy(&nice_foo)); in TEST()
323 EXPECT_TRUE(Mock::IsNice(&nice_foo)); in TEST()
324 EXPECT_FALSE(Mock::IsStrict(&nice_foo)); in TEST()
329 // Tests that a naggy mock generates warnings for uninteresting calls.
340 HasSubstr("Uninteresting mock function call")); in TEST()
345 // Tests that a naggy mock generates a warning for an uninteresting call
346 // that deletes the mock object.
357 naggy_foo->DoThis(); in TEST()
359 HasSubstr("Uninteresting mock function call")); in TEST()
366 // Tests that a naggy mock allows expected calls.
374 // Tests that an unexpected call on a naggy mock fails.
383 // Tests that NaggyMock works with a mock class that has a non-default
393 // Tests that NaggyMock works with a mock class that has a 10-ary
394 // non-default constructor.
406 Mock::AllowLeak(leaked); in TEST()
408 leaked->DoThis(); in TEST()
415 // Tests that NaggyMock<Mock> compiles where Mock is a user-defined
416 // class (as opposed to ::testing::Mock).
418 NaggyMock< ::Mock> naggy; in TEST()
430 // Don't add an expectation for the call before the mock goes out of scope. in TEST()
434 HasSubstr("Uninteresting mock function call")); in TEST()
441 EXPECT_TRUE(Mock::IsNaggy(&naggy_foo)); in TEST()
442 EXPECT_FALSE(Mock::IsNice(&naggy_foo)); in TEST()
443 EXPECT_FALSE(Mock::IsStrict(&naggy_foo)); in TEST()
446 // Tests that a strict mock allows expected calls.
454 // Tests that an unexpected call on a strict mock fails.
463 // Tests that an uninteresting call on a strict mock fails.
468 "Uninteresting mock function call"); in TEST()
471 // Tests that an uninteresting call on a strict mock fails, even if
472 // the call deletes the mock object.
479 EXPECT_NONFATAL_FAILURE(strict_foo->DoThis(), in TEST()
480 "Uninteresting mock function call"); in TEST()
483 // Tests that StrictMock works with a mock class that has a
484 // non-default constructor.
490 "Uninteresting mock function call"); in TEST()
493 // Tests that StrictMock works with a mock class that has a 10-ary
494 // non-default constructor.
501 "Uninteresting mock function call"); in TEST()
506 Mock::AllowLeak(leaked); in TEST()
508 leaked->DoThis(); in TEST()
515 // Tests that StrictMock<Mock> compiles where Mock is a user-defined
516 // class (as opposed to ::testing::Mock).
518 StrictMock< ::Mock> strict; in TEST()
527 // Don't add an expectation for the call before the mock goes out of in TEST()
530 "Uninteresting mock function call"); in TEST()
535 EXPECT_FALSE(Mock::IsNaggy(&strict_foo)); in TEST()
536 EXPECT_FALSE(Mock::IsNice(&strict_foo)); in TEST()
537 EXPECT_TRUE(Mock::IsStrict(&strict_foo)); in TEST()