aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/gmock_in_unittest/registration.cpp
blob: c2872a4c27ee9f5fdb7466f33d9107d09c60ee7c (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());

}