#ifndef FILE_TEST_HH #define FILE_TEST_HH #include "unique_fd.hh" #include #include #include class FileTest : public testing::Test { public: static unique_fd create_temp_file(std::string const& extension, std::filesystem::path* path); protected: FileTest(); ~FileTest() override; void SetUp() override; std::filesystem::path const& path() const { return path_; } void write(std::string_view content); int fd() const { return fd_.get(); } unique_fd release() { return std::move(fd_); } void close(); protected: virtual std::string const& extension(); private: std::filesystem::path path_; unique_fd fd_; }; #endif // FILE_TEST_HH