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

}