Skip to content

Commit 63dbffa

Browse files
committed
Add tests for multiple mode specifications
1 parent 114be93 commit 63dbffa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/by-util/test_mkfifo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ fn test_create_fifo_with_mode_and_umask() {
9999
test_fifo_creation("u-r,g-w,o+x", 0o022, "p-w-r--rwx"); // spell-checker:disable-line
100100
test_fifo_creation("a=rwx,o-w", 0o022, "prwxrwxr-x"); // spell-checker:disable-line
101101
test_fifo_creation("=rwx,o-w", 0o022, "prwxr-xr-x"); // spell-checker:disable-line
102+
test_fifo_creation("ug+rw,o+r", 0o022, "prw-rw-rw-"); // spell-checker:disable-line
103+
test_fifo_creation("u=rwx,g=rx,o=", 0o022, "prwxr-x---"); // spell-checker:disable-line
102104
}
103105

104106
#[test]

tests/by-util/test_mknod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,22 @@ fn test_mknod_mode_permissions() {
154154
}
155155
}
156156

157+
#[test]
158+
fn test_mknod_mode_comma_separated() {
159+
let ts = TestScenario::new(util_name!());
160+
ts.ucmd()
161+
.arg("-m")
162+
.arg("u=rwx,g=rx,o=")
163+
.arg("test_file")
164+
.arg("p")
165+
.succeeds();
166+
assert!(ts.fixtures.is_fifo("test_file"));
167+
assert_eq!(
168+
ts.fixtures.metadata("test_file").permissions().mode() & 0o777,
169+
0o750
170+
);
171+
}
172+
157173
#[test]
158174
#[cfg(feature = "feat_selinux")]
159175
fn test_mknod_selinux() {

0 commit comments

Comments
 (0)