Skip to content

Commit 59f5e8f

Browse files
committed
fixup! WIP add tests
1 parent 274fe54 commit 59f5e8f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/by-util/test_rm.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,16 +826,29 @@ fn test_recursive_symlink_loop() {
826826
}
827827

828828
#[cfg(not(windows))]
829-
#[ignore = "from GNU test file tests/rm/empty-inacc.sh"]
830829
#[test]
831-
fn test_inaccesible_dir() {
830+
fn test_inaccessible_dir() {
832831
let (at, mut ucmd) = at_and_ucmd!();
833832
at.mkdir("dir");
834833
at.set_mode("dir", 0o0333);
835834
ucmd.args(&["-d", "dir"]).succeeds().no_output();
836835
assert!(!at.dir_exists("dir"));
837836
}
838837

838+
#[cfg(not(windows))]
839+
#[test]
840+
fn test_inaccessible_dir_nonempty() {
841+
let (at, mut ucmd) = at_and_ucmd!();
842+
at.mkdir("dir");
843+
at.touch("dir/f");
844+
at.set_mode("dir", 0o0333);
845+
ucmd.args(&["-d", "dir"])
846+
.fails()
847+
.stderr_only("rm: cannot remove 'dir': Directory not empty\n");
848+
assert!(at.file_exists("dir/f"));
849+
assert!(at.dir_exists("dir"));
850+
}
851+
839852
#[cfg(not(windows))]
840853
#[test]
841854
fn test_inaccessible_dir_recursive() {

0 commit comments

Comments
 (0)