From ce271f82f16ee89a18e7bfc9ed8eab7cbd6f37bc Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Mon, 22 Sep 2025 23:38:21 +0200 Subject: Change io::Reader and company to return ReadError::Eof instead of 0. It's debatable if Eof should be considered an error or not. But it is pretty clear it generally is a special response that needs special handling, so easier to keep with the unexpected lot. Also keeps better at higher abstraction levels, such as the line reader. --- test/io.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/io.cc') diff --git a/test/io.cc b/test/io.cc index 843c83e..04d97d6 100644 --- a/test/io.cc +++ b/test/io.cc @@ -128,8 +128,8 @@ TEST_F(IoTest, read_empty) { ASSERT_TRUE(ret.has_value()); std::string tmp(10, ' '); auto ret2 = ret.value()->read(tmp.data(), tmp.size()); - ASSERT_TRUE(ret2.has_value()); - EXPECT_EQ(0, ret2.value()); + ASSERT_FALSE(ret2.has_value()); + EXPECT_EQ(io::ReadError::Eof, ret2.error()); } TEST_F(IoTest, skip_empty) { @@ -138,8 +138,8 @@ TEST_F(IoTest, skip_empty) { auto ret = io::openat(dirfd(), "test"); ASSERT_TRUE(ret.has_value()); auto ret2 = ret.value()->skip(10); - ASSERT_TRUE(ret2.has_value()); - EXPECT_EQ(0, ret2.value()); + ASSERT_FALSE(ret2.has_value()); + EXPECT_EQ(io::ReadError::Eof, ret2.error()); } TEST_F(IoTest, read) { -- cgit v1.3