You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
1.3 KiB

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