diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-29 20:29:50 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-29 20:29:50 +0100 |
| commit | 3e7902f7d790a486d3d9cb978df193f07f3a6ad9 (patch) | |
| tree | fd9815cf214daeec1cad826e040cf8a0cbb6be33 /nihil.posix/test.fd.cc | |
| parent | 67b2fae1fa8b033045a44c1355d9dfd8f83e0d9b (diff) | |
| download | nihil-3e7902f7d790a486d3d9cb978df193f07f3a6ad9.tar.gz nihil-3e7902f7d790a486d3d9cb978df193f07f3a6ad9.tar.bz2 | |
finish macOS support
Diffstat (limited to 'nihil.posix/test.fd.cc')
| -rw-r--r-- | nihil.posix/test.fd.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nihil.posix/test.fd.cc b/nihil.posix/test.fd.cc index 6b6394b..5c282af 100644 --- a/nihil.posix/test.fd.cc +++ b/nihil.posix/test.fd.cc @@ -184,16 +184,21 @@ TEST_CASE("fd: pipe, read, write", "[fd]") { auto fds = nihil::pipe(); REQUIRE(fds); + /* + * Note: traditionally, the first fd is the reading side, and the second fd + * is the writing side. Some platforms (e.g., macOS) still behave this way. + */ + auto [fd1, fd2] = std::move(*fds); auto constexpr test_string = "test string"sv; - auto ret = write(fd1, test_string); + auto ret = write(fd2, test_string); REQUIRE(ret); REQUIRE(*ret == test_string.size()); auto readbuf = std::array<char, test_string.size() * 2>{}; - auto read_buf = read(fd2, readbuf); + auto read_buf = read(fd1, readbuf); REQUIRE(read_buf); REQUIRE(std::string_view(*read_buf) == test_string); } |
