From 3e7902f7d790a486d3d9cb978df193f07f3a6ad9 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sun, 29 Jun 2025 20:29:50 +0100 Subject: finish macOS support --- nihil.posix/test.fd.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'nihil.posix/test.fd.cc') 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{}; - auto read_buf = read(fd2, readbuf); + auto read_buf = read(fd1, readbuf); REQUIRE(read_buf); REQUIRE(std::string_view(*read_buf) == test_string); } -- cgit v1.2.3