diff --git a/bazaar/GoogleMockExample/GoogleMockExample.cpp b/bazaar/GoogleMockExample/GoogleMockExample.cpp new file mode 100644 index 000000000..f038a4f75 --- /dev/null +++ b/bazaar/GoogleMockExample/GoogleMockExample.cpp @@ -0,0 +1,39 @@ +#include +#include + +using namespace Upp; + +class Car { +public: + virtual ~Car() {} + + virtual void OpenHood() = 0; +}; + +class MockCar : public Car { +public: + MOCK_METHOD0(OpenHood, void()); +}; + +class CarRepairShop final { +public: + bool Service(Car& car) { + car.OpenHood(); + } +}; + +TEST(CarRepairShopTest, ServiceChecksAllMainCarElements) { + MockCar car; + + EXPECT_CALL(car, OpenHood()) + .Times(::testing::AtLeast(1)); + + CarRepairShop().Service(car); +} + +int main(int argc, char *argv[]) +{ + testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} diff --git a/bazaar/GoogleMockExample/GoogleMockExample.upp b/bazaar/GoogleMockExample/GoogleMockExample.upp new file mode 100644 index 000000000..3e5e6dd37 --- /dev/null +++ b/bazaar/GoogleMockExample/GoogleMockExample.upp @@ -0,0 +1,7 @@ +uses + Core, + plugin/gmock; + +file + GoogleMockExample.cpp; + diff --git a/bazaar/plugin/gmock/gmock.upp b/bazaar/plugin/gmock/gmock.upp index 590c99331..3c7513d70 100644 --- a/bazaar/plugin/gmock/gmock.upp +++ b/bazaar/plugin/gmock/gmock.upp @@ -1,4 +1,4 @@ -description "Google C++ mocking framework\3770,128,128"; +description "Google C++ mocking framework (Depends on Google Test)\3770,128,128"; uses plugin/gtest;