test/fd: Split out some utility functions

Change-Id: Ic87a40a82111676988344702db60ca96ef74a0de
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/fd/line.cpp b/test/fd/line.cpp
index 2913a25..25bad75 100644
--- a/test/fd/line.cpp
+++ b/test/fd/line.cpp
@@ -1,14 +1,10 @@
-#include <sys/mman.h>
+#include "util.hpp"
 
 #include <stdplus/exception.hpp>
 #include <stdplus/fd/gmock.hpp>
 #include <stdplus/fd/line.hpp>
-#include <stdplus/fd/managed.hpp>
-#include <stdplus/fd/ops.hpp>
-#include <stdplus/raw.hpp>
-#include <stdplus/util/cexec.hpp>
 
-#include <string_view>
+#include <string>
 
 #include <gtest/gtest.h>
 
@@ -17,14 +13,6 @@
 namespace fd
 {
 
-ManagedFd makeMemfd(std::string_view contents)
-{
-    auto fd = ManagedFd(CHECK_ERRNO(memfd_create("test", 0), "memfd_create"));
-    write(fd, contents);
-    lseek(fd, 0, Whence::Set);
-    return fd;
-}
-
 TEST(LineReader, Empty)
 {
     auto fd = makeMemfd("");
@@ -70,17 +58,6 @@
 
 using testing::_;
 
-inline auto readSv(std::string_view s)
-{
-    return [s](std::span<std::byte> buf) {
-        if (s.size())
-        {
-            memcpy(buf.data(), s.data(), s.size());
-        }
-        return buf.subspan(0, s.size());
-    };
-}
-
 TEST(LineReader, Nonblock)
 {
     FdMock fd;