|
@@ -140,6 +140,18 @@ TEST_CASE(file_adopt_invalid_fd)
|
|
|
|
|
|
// TCPSocket tests
|
|
|
|
|
|
+TEST_CASE(should_error_when_connection_fails)
|
|
|
+{
|
|
|
+ // NOTE: This is required here because Core::TCPSocket requires
|
|
|
+ // Core::EventLoop through Core::Notifier.
|
|
|
+ Core::EventLoop event_loop;
|
|
|
+
|
|
|
+ auto maybe_tcp_socket = Core::Stream::TCPSocket::connect({ { 127, 0, 0, 1 }, 1234 });
|
|
|
+ EXPECT(maybe_tcp_socket.is_error());
|
|
|
+ EXPECT(maybe_tcp_socket.error().is_syscall());
|
|
|
+ EXPECT(maybe_tcp_socket.error().code() == ECONNREFUSED);
|
|
|
+}
|
|
|
+
|
|
|
constexpr auto sent_data = "Mr. Watson, come here. I want to see you."sv;
|
|
|
|
|
|
TEST_CASE(tcp_socket_read)
|