diff options
author | cerevra <cerevra@yandex-team.ru> | 2022-02-10 16:45:59 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:59 +0300 |
commit | 4f292c7e2fd0a41da93fda51b2d440c979a330b7 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/network/socket_ut.cpp | |
parent | bf41dd01f6c920583e9faae7cd55ed25e547e052 (diff) | |
download | ydb-4f292c7e2fd0a41da93fda51b2d440c979a330b7.tar.gz |
Restoring authorship annotation for <cerevra@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/network/socket_ut.cpp')
-rw-r--r-- | util/network/socket_ut.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index 00f27fce4b..6b20e11f70 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -22,7 +22,7 @@ class TSockTest: public TTestBase { UNIT_TEST_EXCEPTION(TestConnectionRefused, yexception); #endif UNIT_TEST(TestNetworkResolutionError); - UNIT_TEST(TestNetworkResolutionErrorMessage); + UNIT_TEST(TestNetworkResolutionErrorMessage); UNIT_TEST(TestBrokenPipe); UNIT_TEST(TestClose); UNIT_TEST(TestReusePortAvailCheck); @@ -33,7 +33,7 @@ public: void TestTimeout(); void TestConnectionRefused(); void TestNetworkResolutionError(); - void TestNetworkResolutionErrorMessage(); + void TestNetworkResolutionErrorMessage(); void TestBrokenPipe(); void TestClose(); void TestReusePortAvailCheck(); @@ -92,42 +92,42 @@ void TSockTest::TestNetworkResolutionError() { } } -void TSockTest::TestNetworkResolutionErrorMessage() { -#ifdef _unix_ - auto str = [](int code) -> TString { - return TNetworkResolutionError(code).what(); - }; - - auto expected = [](int code) -> TString { - return gai_strerror(code); - }; - - struct TErrnoGuard { - TErrnoGuard() +void TSockTest::TestNetworkResolutionErrorMessage() { +#ifdef _unix_ + auto str = [](int code) -> TString { + return TNetworkResolutionError(code).what(); + }; + + auto expected = [](int code) -> TString { + return gai_strerror(code); + }; + + struct TErrnoGuard { + TErrnoGuard() : PrevValue_(errno) - { - } - - ~TErrnoGuard() { + { + } + + ~TErrnoGuard() { errno = PrevValue_; - } - - private: + } + + private: int PrevValue_; - } g; - - UNIT_ASSERT_VALUES_EQUAL(expected(0) + "(0): ", str(0)); - UNIT_ASSERT_VALUES_EQUAL(expected(-9) + "(-9): ", str(-9)); - - errno = 0; - UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=0): ", - str(EAI_SYSTEM)); - errno = 110; - UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=110): ", - str(EAI_SYSTEM)); -#endif -} - + } g; + + UNIT_ASSERT_VALUES_EQUAL(expected(0) + "(0): ", str(0)); + UNIT_ASSERT_VALUES_EQUAL(expected(-9) + "(-9): ", str(-9)); + + errno = 0; + UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=0): ", + str(EAI_SYSTEM)); + errno = 110; + UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=110): ", + str(EAI_SYSTEM)); +#endif +} + class TTempEnableSigPipe { public: TTempEnableSigPipe() { |