aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/gmock_in_unittest/registration.cpp
blob: e6186a1bc6c88b4e1c4f06c828aa583bebbb2c2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "events.h"

#include <gmock/gmock.h>

#include <library/cpp/testing/unittest/plugin.h>

namespace {
    class TGMockUnittestPlugin: public NUnitTest::NPlugin::IPlugin {
    public:
        void OnStartMain(int argc, char* argv[]) override {
            testing::InitGoogleMock(&argc, argv);
            testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners();
            delete listeners.Release(listeners.default_result_printer());
            listeners.Append(new TGMockTestEventListener());
        }
    };

    NUnitTest::NPlugin::TPluginRegistrator registerGMock(new TGMockUnittestPlugin());

}