summaryrefslogtreecommitdiff
path: root/Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2019-12-29 15:42:16 +0100
committerLéo Lam <leo@leolam.fr>2020-01-25 17:53:39 +0100
commit484cfb93288ee593d860e824ee466dc244f72ceb (patch)
tree938b78b16a95f565f862fe9f6dddf1597910a010 /Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp
parent142b7e048b5243c42cf8b24f244187cb848ea7b5 (diff)
UnitTests/FS: Add metadata tests
Diffstat (limited to 'Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp')
-rw-r--r--Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp b/Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp
index 3a4f443139..c84caf6f6a 100644
--- a/Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp
+++ b/Source/UnitTests/Core/IOS/FS/FileSystemTest.cpp
@@ -52,14 +52,18 @@ TEST_F(FileSystemTest, CreateFile)
{
const std::string PATH = "/tmp/f";
- ASSERT_EQ(m_fs->CreateFile(Uid{0}, Gid{0}, PATH, 0, modes), ResultCode::Success);
+ constexpr u8 ArbitraryAttribute = 0xE1;
+
+ ASSERT_EQ(m_fs->CreateFile(Uid{0}, Gid{0}, PATH, ArbitraryAttribute, modes), ResultCode::Success);
const Result<Metadata> stats = m_fs->GetMetadata(Uid{0}, Gid{0}, PATH);
ASSERT_TRUE(stats.Succeeded());
EXPECT_TRUE(stats->is_file);
EXPECT_EQ(stats->size, 0u);
- // TODO: After we start saving metadata correctly, check the UID, GID, permissions
- // as well (issue 10234).
+ EXPECT_EQ(stats->uid, 0);
+ EXPECT_EQ(stats->gid, 0);
+ EXPECT_EQ(stats->modes, modes);
+ EXPECT_EQ(stats->attribute, ArbitraryAttribute);
ASSERT_EQ(m_fs->CreateFile(Uid{0}, Gid{0}, PATH, 0, modes), ResultCode::AlreadyExists);
@@ -72,21 +76,24 @@ TEST_F(FileSystemTest, CreateDirectory)
{
const std::string PATH = "/tmp/d";
- ASSERT_EQ(m_fs->CreateDirectory(Uid{0}, Gid{0}, PATH, 0, modes), ResultCode::Success);
+ constexpr u8 ArbitraryAttribute = 0x20;
+
+ ASSERT_EQ(m_fs->CreateDirectory(Uid{0}, Gid{0}, PATH, ArbitraryAttribute, modes),
+ ResultCode::Success);
const Result<Metadata> stats = m_fs->GetMetadata(Uid{0}, Gid{0}, PATH);
ASSERT_TRUE(stats.Succeeded());
EXPECT_FALSE(stats->is_file);
- // TODO: After we start saving metadata correctly, check the UID, GID, permissions
- // as well (issue 10234).
+ EXPECT_EQ(stats->uid, 0);
+ EXPECT_EQ(stats->gid, 0);
+ EXPECT_EQ(stats->modes, modes);
+ EXPECT_EQ(stats->attribute, ArbitraryAttribute);
const Result<std::vector<std::string>> children = m_fs->ReadDirectory(Uid{0}, Gid{0}, PATH);
ASSERT_TRUE(children.Succeeded());
EXPECT_TRUE(children->empty());
- // TODO: uncomment this after the FS code is fixed to return AlreadyExists.
- // EXPECT_EQ(m_fs->CreateDirectory(Uid{0}, Gid{0}, PATH, 0, Mode::Read, Mode::None, Mode::None),
- // ResultCode::AlreadyExists);
+ EXPECT_EQ(m_fs->CreateDirectory(Uid{0}, Gid{0}, PATH, 0, modes), ResultCode::AlreadyExists);
}
TEST_F(FileSystemTest, Delete)