diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-12-11 19:21:36 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-12 14:16:42 +0100 |
commit | 9a3e95785e80a6b03e8d71605ddb603bb6776b69 (patch) | |
tree | abeba5b04e7b452041dc3054fbac56dc1b91d482 /Tests/LibCore/TestLibCoreStream.cpp | |
parent | 6c7c5a6786f5f168b9e228f9d4b41ed1e64bc8f3 (diff) | |
download | serenity-9a3e95785e80a6b03e8d71605ddb603bb6776b69.zip |
LibCore: Propagate errors from `Stream::*_entire_buffer`
Diffstat (limited to 'Tests/LibCore/TestLibCoreStream.cpp')
-rw-r--r-- | Tests/LibCore/TestLibCoreStream.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Tests/LibCore/TestLibCoreStream.cpp b/Tests/LibCore/TestLibCoreStream.cpp index a56bc32044..40c7f92fd5 100644 --- a/Tests/LibCore/TestLibCoreStream.cpp +++ b/Tests/LibCore/TestLibCoreStream.cpp @@ -87,17 +87,17 @@ TEST_CASE(file_seeking_around) EXPECT(!file->seek(500, Core::Stream::SeekMode::SetPosition).is_error()); EXPECT_EQ(file->tell().release_value(), 500); - EXPECT(file->read_entire_buffer(buffer)); + EXPECT(!file->read_entire_buffer(buffer).is_error()); EXPECT_EQ(buffer_contents, expected_seek_contents1); EXPECT(!file->seek(234, Core::Stream::SeekMode::FromCurrentPosition).is_error()); EXPECT_EQ(file->tell().release_value(), 750); - EXPECT(file->read_entire_buffer(buffer)); + EXPECT(!file->read_entire_buffer(buffer).is_error()); EXPECT_EQ(buffer_contents, expected_seek_contents2); EXPECT(!file->seek(-105, Core::Stream::SeekMode::FromEndPosition).is_error()); EXPECT_EQ(file->tell().release_value(), 8597); - EXPECT(file->read_entire_buffer(buffer)); + EXPECT(!file->read_entire_buffer(buffer).is_error()); EXPECT_EQ(buffer_contents, expected_seek_contents3); } @@ -120,7 +120,7 @@ TEST_CASE(file_adopt_fd) EXPECT(!file->seek(500, Core::Stream::SeekMode::SetPosition).is_error()); EXPECT_EQ(file->tell().release_value(), 500); - EXPECT(file->read_entire_buffer(buffer)); + EXPECT(!file->read_entire_buffer(buffer).is_error()); EXPECT_EQ(buffer_contents, expected_seek_contents1); // A single seek & read test should be fine for now. @@ -218,7 +218,7 @@ TEST_CASE(tcp_socket_write) auto server_socket = maybe_server_socket.release_value(); EXPECT(!server_socket->set_blocking(true).is_error()); - EXPECT(client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() })); + EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error()); client_socket->close(); auto maybe_receive_buffer = ByteBuffer::create_uninitialized(64); @@ -282,7 +282,7 @@ TEST_CASE(udp_socket_read_write) auto client_socket = maybe_client_socket.release_value(); EXPECT(client_socket->is_open()); - EXPECT(client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() })); + EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error()); // FIXME: UDPServer::receive sadly doesn't give us a way to block on it, // currently. @@ -400,7 +400,7 @@ TEST_CASE(local_socket_write) EXPECT(!maybe_client_socket.is_error()); auto client_socket = maybe_client_socket.release_value(); - EXPECT(client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() })); + EXPECT(!client_socket->write_entire_buffer({ sent_data.characters_without_null_termination(), sent_data.length() }).is_error()); client_socket->close(); return 0; |