summaryrefslogtreecommitdiff
path: root/Tests/LibCore/TestLibCoreFilePermissionsMask.cpp
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2022-07-25 14:28:38 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-07-27 21:45:01 +0000
commit6c4b5775e1ac45a96d3b8c65b3e7fb93a6135d3d (patch)
tree6fe7d47c7006e3e903598267555ddec87966e811 /Tests/LibCore/TestLibCoreFilePermissionsMask.cpp
parent130f04c493122b4e7c3f7be36c1ed840c7299087 (diff)
downloadserenity-6c4b5775e1ac45a96d3b8c65b3e7fb93a6135d3d.zip
LibCore: Implement four-digit modes for `FilePermissionsMask` parsing
Diffstat (limited to 'Tests/LibCore/TestLibCoreFilePermissionsMask.cpp')
-rw-r--r--Tests/LibCore/TestLibCoreFilePermissionsMask.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/LibCore/TestLibCoreFilePermissionsMask.cpp b/Tests/LibCore/TestLibCoreFilePermissionsMask.cpp
index 1dc303c0c6..55f300be5f 100644
--- a/Tests/LibCore/TestLibCoreFilePermissionsMask.cpp
+++ b/Tests/LibCore/TestLibCoreFilePermissionsMask.cpp
@@ -116,3 +116,24 @@ TEST_CASE(file_permission_mask_parse)
mask = Core::FilePermissionsMask::parse("z+rw"sv);
EXPECT(mask.is_error());
}
+
+TEST_CASE(numeric_mask_special_bits)
+{
+ {
+ auto mask = Core::FilePermissionsMask::parse("750"sv);
+ EXPECT(!mask.is_error());
+ EXPECT_EQ(mask.value().apply(07000), 07750);
+ }
+
+ {
+ auto mask = Core::FilePermissionsMask::parse("7750"sv);
+ EXPECT(!mask.is_error());
+ EXPECT_EQ(mask.value().apply(0), 07750);
+ }
+
+ {
+ auto mask = Core::FilePermissionsMask::parse("0750"sv);
+ EXPECT(!mask.is_error());
+ EXPECT_EQ(mask.value().apply(07000), 0750);
+ }
+}