libcryfs/test/fspp/fuse/statfs/FuseStatfsErrorTest.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

30 lines
997 B
C++

#include "testutils/FuseStatfsTest.h"
#include "fspp/fs_interface/FuseErrnoException.h"
using ::testing::Throw;
using ::testing::Return;
using ::testing::WithParamInterface;
using ::testing::Values;
using fspp::fuse::FuseErrnoException;
class FuseStatfsErrorTest: public FuseStatfsTest, public WithParamInterface<int> {
public:
};
INSTANTIATE_TEST_SUITE_P(FuseStatfsErrorTest, FuseStatfsErrorTest, Values(EACCES, EBADF, EFAULT, EINTR, EIO, ELOOP, ENAMETOOLONG, ENOENT, ENOMEM, ENOSYS, ENOTDIR, EOVERFLOW));
TEST_F(FuseStatfsErrorTest, ReturnNoError) {
ReturnIsFileOnLstat(FILENAME);
EXPECT_CALL(*fsimpl, statfs(testing::_)).Times(1).WillOnce(Return());
const int error = StatfsReturnError(FILENAME);
EXPECT_EQ(0, error);
}
TEST_P(FuseStatfsErrorTest, ReturnError) {
ReturnIsFileOnLstat(FILENAME);
EXPECT_CALL(*fsimpl, statfs(testing::_)).Times(1).WillOnce(Throw(FuseErrnoException(GetParam())));
const int error = StatfsReturnError(FILENAME);
EXPECT_EQ(GetParam(), error);
}