Implement ReturnIsFileStat action
This commit is contained in:
parent
205f93531f
commit
988c9b4307
@ -35,9 +35,7 @@ TEST_F(FuseTest, setupAndTearDown) {
|
||||
|
||||
TEST_F(FuseTest, openFile) {
|
||||
const char *filename = "/myfile";
|
||||
EXPECT_CALL(fsimpl, lstat(StrEq(filename), _)).WillOnce(Invoke([](const char*, struct ::stat* result) {
|
||||
result->st_mode = S_IFREG;
|
||||
}));
|
||||
EXPECT_CALL(fsimpl, lstat(StrEq(filename), _)).WillOnce(ReturnIsFileStat);
|
||||
EXPECT_CALL(fsimpl, openFile(StrEq(filename), OpenFlagsEq(O_RDWR)))
|
||||
.Times(1);
|
||||
|
||||
|
@ -118,10 +118,17 @@ public:
|
||||
}
|
||||
|
||||
MockFilesystem fsimpl;
|
||||
|
||||
static ::testing::Action<void(const char*, struct ::stat*)> ReturnIsFileStat;
|
||||
};
|
||||
|
||||
MATCHER_P(OpenFlagsEq, expectedFlags, "") {
|
||||
return expectedFlags == (O_ACCMODE & arg);
|
||||
}
|
||||
|
||||
::testing::Action<void(const char*, struct ::stat*)> FuseTest::ReturnIsFileStat =
|
||||
::testing::Invoke([](const char*, struct ::stat* result) {
|
||||
result->st_mode = S_IFREG;
|
||||
});
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user