summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-01-18 13:33:40 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-20 10:39:54 +0100
commit2d4261df49bdf499f809a5d7143307bd6c409df6 (patch)
tree7c5ed8d8ebf3127517f30efb737bbae676d0b2a8 /Tests
parentee74aafdca1ae575276e2cb94c475450cb13d945 (diff)
downloadserenity-2d4261df49bdf499f809a5d7143307bd6c409df6.zip
Tests: Fix the TestLibCoreStream local_socket_write test
Accidentally regressed this test during the Core::LocalServer refactor, and didn't catch it since TestLibCoreStream is disabled in the CI right now. We have to wait for some data to become available, as pending_bytes will immediately return 0 and a 0-sized read immediately returns.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibCore/TestLibCoreStream.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp
index 4e43bc93f2..f0926e2da3 100644
--- a/Tests/LibCore/TestLibCoreStream.cpp
+++ b/Tests/LibCore/TestLibCoreStream.cpp
@@ -350,11 +350,12 @@ TEST_CASE(local_socket_write)
// NOTE: For some reason LocalServer gives us a nonblocking socket..?
MUST(server_socket->set_blocking(true));
+ EXPECT(MUST(server_socket->can_read_without_blocking(100)));
auto pending_bytes = MUST(server_socket->pending_bytes());
auto receive_buffer = ByteBuffer::create_uninitialized(pending_bytes).release_value();
auto maybe_nread = server_socket->read(receive_buffer);
EXPECT(!maybe_nread.is_error());
- EXPECT(maybe_nread.value() == sent_data.length());
+ EXPECT_EQ(maybe_nread.value(), sent_data.length());
StringView received_data { receive_buffer.data(), maybe_nread.value() };
EXPECT_EQ(sent_data, received_data);