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