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/uio.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/uio.cc') diff --git a/test/uio.cc b/test/uio.cc index 47646e0..7d4c073 100644 --- a/test/uio.cc +++ b/test/uio.cc @@ -12,16 +12,16 @@ TEST(uio_u8, empty) { auto uio = u8::open(io::memory("")); std::string tmp; auto ret = uio->repeat_read(tmp, 10); - ASSERT_TRUE(ret.has_value()); - EXPECT_EQ(0, ret.value()); + ASSERT_FALSE(ret.has_value()); + EXPECT_EQ(io::ReadError::Eof, ret.error()); } TEST(uio_u16, empty) { auto uio = u16::open(io::memory("")); std::u16string tmp; auto ret = uio->repeat_read(tmp, 10); - ASSERT_TRUE(ret.has_value()); - EXPECT_EQ(0, ret.value()); + ASSERT_FALSE(ret.has_value()); + EXPECT_EQ(io::ReadError::Eof, ret.error()); } TEST(uio_u8, sample) { -- cgit v1.3