aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp
diff options
context:
space:
mode:
authordancingqueue <dancingqueue@yandex-team.ru>2022-02-10 16:50:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:06 +0300
commit3c712c7c680d2b93fae03957df9561bd08eb5b7c (patch)
tree67c4d640d22500fe4daafe7144095c91d77424b1 /library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp
parent0ba74a57f9d49cfef11e512659c5847b98867342 (diff)
downloadydb-3c712c7c680d2b93fae03957df9561bd08eb5b7c.tar.gz
Restoring authorship annotation for <dancingqueue@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp')
-rw-r--r--library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp
index 81cdfd0427..4c1f48e593 100644
--- a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp
+++ b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp
@@ -1,49 +1,49 @@
#include <library/cpp/testing/gtest/gtest.h>
-
+
#include <util/generic/string.h>
#include <util/generic/maybe.h>
#include <util/stream/output.h>
#include <util/stream/str.h>
-
-namespace {
- class IMock {
- public:
- virtual void M1(const TStringBuf&) = 0;
- virtual void M2(TStringBuf) = 0;
- virtual void M3(const TString&) = 0;
- virtual void M4(TString) = 0;
- };
-
- class TSampleMock : IMock {
- public:
- MOCK_METHOD(void, M1, (const TStringBuf&));
- MOCK_METHOD(void, M2, (TStringBuf));
- MOCK_METHOD(void, M3, (const TString&));
- MOCK_METHOD(void, M4, (TString));
- };
-}
-
-
+
+namespace {
+ class IMock {
+ public:
+ virtual void M1(const TStringBuf&) = 0;
+ virtual void M2(TStringBuf) = 0;
+ virtual void M3(const TString&) = 0;
+ virtual void M4(TString) = 0;
+ };
+
+ class TSampleMock : IMock {
+ public:
+ MOCK_METHOD(void, M1, (const TStringBuf&));
+ MOCK_METHOD(void, M2, (TStringBuf));
+ MOCK_METHOD(void, M3, (const TString&));
+ MOCK_METHOD(void, M4, (TString));
+ };
+}
+
+
TEST(MatchersSpecializations, String) {
TSampleMock mock;
-
+
TStringBuf simpleStringBuf = "SimpleStringBuf";
const TStringBuf constSimpleStringBuf = "ConstSimpleStringBuf";
-
+
TString simpleString = "SimpleString";
const TString constSimpleString = "ConstSimpleString";
-
+
EXPECT_CALL(mock, M1("ConstSimpleStringBuf")).Times(1);
EXPECT_CALL(mock, M2("SimpleStringBuf")).Times(1);
EXPECT_CALL(mock, M3("ConstSimpleString")).Times(1);
EXPECT_CALL(mock, M4("SimpleString")).Times(1);
-
+
mock.M1(constSimpleStringBuf);
mock.M2(simpleStringBuf);
mock.M3(constSimpleString);
mock.M4(simpleString);
}
-
+
template <typename T, typename M>
std::pair<bool, std::string> Match(T&& t, M&& m) {
testing::StringMatchResultListener listener;
@@ -233,9 +233,9 @@ struct TThrowsOnMove {
TThrowsOnMove() = default;
TThrowsOnMove(TThrowsOnMove&&) {
ythrow yexception() << "move failed";
- }
+ }
};
-
+
TEST(PrettyPrinters, String) {
EXPECT_EQ(GtestPrint(TString("hello world")), "\"hello world\"");
EXPECT_EQ(GtestPrint(TStringBuf("hello world")), "\"hello world\"");