diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-09-22 23:38:21 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-09-22 23:38:21 +0200 |
| commit | ce271f82f16ee89a18e7bfc9ed8eab7cbd6f37bc (patch) | |
| tree | 3e568faf83ae750aa244cca87b55951c7401ef03 /test/uio.cc | |
| parent | 50348284f5d82ccfd65b0c803ba0ba895912ceff (diff) | |
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.
Diffstat (limited to 'test/uio.cc')
| -rw-r--r-- | test/uio.cc | 8 |
1 files changed, 4 insertions, 4 deletions
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) { |
