mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
rm: added test for rm_prompt_write_protected
Signed-off-by: Stefin <stefin@pm.me>
This commit is contained in:
parent
a8326d7f3f
commit
ad4eac867f
1 changed files with 30 additions and 0 deletions
|
@ -363,3 +363,33 @@ fn test_rm_directory_rights_rm1() {
|
|||
assert!(!at.dir_exists("b/c"));
|
||||
assert!(!at.dir_exists("b/d"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_prompt_write_protected_yes() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
let file_1 = "test_rm_prompt_write_protected_1";
|
||||
|
||||
at.touch(file_1);
|
||||
|
||||
#[cfg(feature = "chmod")]
|
||||
scene.ccmd("chmod").arg("0").arg(file_1).succeeds();
|
||||
|
||||
scene.ucmd().arg(file_1).pipe_in("y").succeeds();
|
||||
assert!(!at.file_exists(file_1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_prompt_write_protected_no() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
let file_2 = "test_rm_prompt_write_protected_2";
|
||||
|
||||
at.touch(file_2);
|
||||
|
||||
#[cfg(feature = "chmod")]
|
||||
scene.ccmd("chmod").arg("0").arg(file_2).succeeds();
|
||||
|
||||
scene.ucmd().arg(file_2).pipe_in("n").succeeds();
|
||||
assert!(at.file_exists(file_2));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue