| 1 | #ifndef APT_TESTS_FILE_HELPERS |
| 2 | #define APT_TESTS_FILE_HELPERS |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | class FileFd; |
| 9 | |
| 10 | #define createTemporaryDirectory(id, dir) \ |
| 11 | ASSERT_NO_FATAL_FAILURE(helperCreateTemporaryDirectory(id, dir)) |
| 12 | void helperCreateTemporaryDirectory(std::string const &id, std::string &dir); |
| 13 | #define removeDirectory(dir) \ |
| 14 | ASSERT_NO_FATAL_FAILURE(helperRemoveDirectory(dir)) |
| 15 | void helperRemoveDirectory(std::string const &dir); |
| 16 | #define createFile(dir, name) \ |
| 17 | ASSERT_NO_FATAL_FAILURE(helperCreateFile(dir, name)) |
| 18 | void helperCreateFile(std::string const &dir, std::string const &name); |
| 19 | #define createDirectory(dir, name) \ |
| 20 | ASSERT_NO_FATAL_FAILURE(helperCreateDirectory(dir, name)) |
| 21 | void helperCreateDirectory(std::string const &dir, std::string const &name); |
| 22 | #define createLink(dir, targetname, linkname) \ |
| 23 | ASSERT_NO_FATAL_FAILURE(helperCreateLink(dir, targetname, linkname)) |
| 24 | void helperCreateLink(std::string const &dir, std::string const &targetname, std::string const &linkname); |
| 25 | #define createTemporaryFile(id, fd, filename, content) \ |
| 26 | ASSERT_NO_FATAL_FAILURE(helperCreateTemporaryFile(id, fd, filename, content)) |
| 27 | void helperCreateTemporaryFile(std::string const &id, FileFd &fd, std::string * const filename, char const * const content); |
| 28 | |
| 29 | #endif |