rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh

This commit is contained in:
Sylvestre Ledru 2022-04-03 00:35:35 +02:00
parent 7debdbbbaa
commit 02cc67c915
2 changed files with 24 additions and 3 deletions

View file

@ -24,7 +24,7 @@ use walkdir::{DirEntry, WalkDir};
#[derive(Eq, PartialEq, Clone, Copy)]
enum InteractiveMode {
None,
Never,
Once,
Always,
}
@ -101,7 +101,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
InteractiveMode::Once
} else if matches.is_present(OPT_INTERACTIVE) {
match matches.value_of(OPT_INTERACTIVE).unwrap() {
"none" => InteractiveMode::None,
"never" => InteractiveMode::Never,
"once" => InteractiveMode::Once,
"always" => InteractiveMode::Always,
val => {
@ -112,7 +112,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}
}
} else {
InteractiveMode::None
InteractiveMode::Never
}
},
one_fs: matches.is_present(OPT_ONE_FILE_SYSTEM),

View file

@ -326,3 +326,24 @@ fn test_rm_silently_accepts_presume_input_tty2() {
assert!(!at.file_exists(file_2));
}
#[test]
fn test_rm_interactive_never() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let file_2 = "test_rm_interactive";
at.touch(file_2);
#[cfg(feature = "chmod")]
scene.ccmd("chmod").arg("0").arg(file_2).succeeds();
scene
.ucmd()
.arg("--interactive=never")
.arg(file_2)
.succeeds()
.stdout_is("");
assert!(!at.file_exists(file_2));
}