libcryfs/test/fspp/fuse/unlink/testutils/FuseUnlinkTest.cpp
Sebastian Messmer 9ccb006f61 - Switch some CI jobs to clang 15
- Fix clang-tidy warnings from Clang 15
2023-07-08 14:48:59 -07:00

28 lines
679 B
C++

#include "FuseUnlinkTest.h"
using ::testing::Action;
using ::testing::Invoke;
void FuseUnlinkTest::Unlink(const char *filename) {
const int error = UnlinkReturnError(filename);
EXPECT_EQ(0, error);
}
int FuseUnlinkTest::UnlinkReturnError(const char *filename) {
auto fs = TestFS();
auto realpath = fs->mountDir() / filename;
const int retval = ::unlink(realpath.string().c_str());
if (0 == retval) {
return 0;
} else {
return errno;
}
}
Action<void(const boost::filesystem::path&)> FuseUnlinkTest::FromNowOnReturnDoesntExistOnLstat() {
return Invoke([this](const boost::filesystem::path& filename) {
ReturnDoesntExistOnLstat(filename);
});
}