| 91 | } |
| 92 | |
| 93 | void TSockTest::TestNetworkResolutionErrorMessage() { |
| 94 | #ifdef _unix_ |
| 95 | auto str = [](int code) -> TString { |
| 96 | return TNetworkResolutionError(code).what(); |
| 97 | }; |
| 98 | |
| 99 | auto expected = [](int code) -> TString { |
| 100 | return gai_strerror(code); |
| 101 | }; |
| 102 | |
| 103 | struct TErrnoGuard { |
| 104 | TErrnoGuard() |
| 105 | : PrevValue_(errno) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | ~TErrnoGuard() { |
| 110 | errno = PrevValue_; |
| 111 | } |
| 112 | |
| 113 | private: |
| 114 | int PrevValue_; |
| 115 | } g; |
| 116 | |
| 117 | UNIT_ASSERT_VALUES_EQUAL(expected(0) + "(0): ", str(0)); |
| 118 | UNIT_ASSERT_VALUES_EQUAL(expected(-9) + "(-9): ", str(-9)); |
| 119 | |
| 120 | errno = 0; |
| 121 | UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=0): ", |
| 122 | str(EAI_SYSTEM)); |
| 123 | errno = 110; |
| 124 | UNIT_ASSERT_VALUES_EQUAL(expected(EAI_SYSTEM) + "(" + IntToString<10>(EAI_SYSTEM) + "; errno=110): ", |
| 125 | str(EAI_SYSTEM)); |
| 126 | #endif |
| 127 | } |
| 128 | |
| 129 | class TTempEnableSigPipe { |
| 130 | public: |
nothing calls this directly
no test coverage detected