Skip to content

Commit

Permalink
add test for open dir
Browse files Browse the repository at this point in the history
  • Loading branch information
KoyamaSohei committed Sep 19, 2024
1 parent d01511f commit fd3c885
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/finchfs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@ TEST(FinchfsTest, Open4)
EXPECT_EQ(finchfs_term(), 0);
}

TEST(FinchfsTest, Open_Dir)
{
EXPECT_EQ(finchfs_init(NULL), 0);
int fd;
fd = finchfs_open("/", O_RDONLY | O_DIRECTORY);
EXPECT_EQ(fd, 0);
finchfs_close(fd);
EXPECT_EQ(finchfs_term(), 0);
}

TEST(FinchfsTest, Open_Dir_2)
{
EXPECT_EQ(finchfs_init(NULL), 0);
EXPECT_EQ(finchfs_mkdir("/open_dir", 0777), 0);
int fd;
fd = finchfs_open("/open_dir", O_RDONLY | O_DIRECTORY);
EXPECT_EQ(fd, 0);
finchfs_close(fd);
EXPECT_EQ(finchfs_term(), 0);
}

TEST(FinchfsTest, Write)
{
EXPECT_EQ(finchfs_init(NULL), 0);
Expand Down

0 comments on commit fd3c885

Please sign in to comment.