mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
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.
This commit is contained in:
parent
ee74aafdca
commit
2d4261df49
Notes:
sideshowbarker
2024-07-17 20:34:04 +09:00
Author: https://github.com/sin-ack
Commit: 2d4261df49
Pull-request: https://github.com/SerenityOS/serenity/pull/11992
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue