Commit 838f86a2 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

Don't hardcode the value of ECONNREFUSED in AsyncSocketExceptionTest

Summary: The value of `ECONNREFUSED` is different on different platforms, so we can't hard-code the value.

Reviewed By: yfeldblum

Differential Revision: D12818063

fbshipit-source-id: 94242a042bef75b391d075a74837b538083d242d
parent e1b1233a
...@@ -13,15 +13,17 @@ ...@@ -13,15 +13,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <array>
#include <folly/io/async/AsyncSocketException.h> #include <folly/io/async/AsyncSocketException.h>
#include <array>
#include <folly/Conv.h>
#include <folly/io/async/SSLContext.h> #include <folly/io/async/SSLContext.h>
#include <folly/io/async/ssl/SSLErrors.h> #include <folly/io/async/ssl/SSLErrors.h>
#include <folly/ssl/Init.h>
#include <folly/portability/GTest.h> #include <folly/portability/GTest.h>
#include <folly/portability/OpenSSL.h> #include <folly/portability/OpenSSL.h>
#include <folly/ssl/Init.h>
using namespace testing; using namespace testing;
...@@ -42,14 +44,15 @@ TEST(AsyncSocketException, SimpleTest) { ...@@ -42,14 +44,15 @@ TEST(AsyncSocketException, SimpleTest) {
AsyncSocketException ex2( AsyncSocketException ex2(
AsyncSocketException::AsyncSocketExceptionType::BAD_ARGS, AsyncSocketException::AsyncSocketExceptionType::BAD_ARGS,
"test exception 2", "test exception 2",
111 /*ECONNREFUSED*/); ECONNREFUSED);
EXPECT_EQ( EXPECT_EQ(
AsyncSocketException::AsyncSocketExceptionType::BAD_ARGS, ex2.getType()); AsyncSocketException::AsyncSocketExceptionType::BAD_ARGS, ex2.getType());
EXPECT_EQ(111, ex2.getErrno()); EXPECT_EQ(ECONNREFUSED, ex2.getErrno());
EXPECT_EQ( EXPECT_EQ(
"AsyncSocketException: test exception 2, type = Invalid arguments, " "AsyncSocketException: test exception 2, type = Invalid arguments, "
"errno = 111 (Connection refused)", "errno = " +
to<std::string>(ECONNREFUSED) + " (Connection refused)",
std::string(ex2.what())); std::string(ex2.what()));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment