libcruft-util/test/fs/tmp.cpp

21 lines
512 B
C++
Raw Permalink Normal View History

2022-01-19 16:04:48 +11:00
#include <cruft/util/tap.hpp>
#include <cruft/util/fs/tmp.hpp>
#include <cruft/util/fs/scoped.hpp>
#include <filesystem>
int main (int, char **)
{
cruft::TAP::logger tap;
{
cruft::fs::scoped_dir dir (cruft::fs::mktmpdir ());
tap.expect (std::filesystem::is_directory (*dir), "tmpdir is a directory");
2022-05-27 13:20:02 +10:00
auto const tmpfile = cruft::fs::mktempfile (*dir);
tap.expect (std::filesystem::is_regular_file (tmpfile), "mktempfile is a file");
2022-01-19 16:04:48 +11:00
}
return tap.status ();
}