1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #4823 from shinhs0506/mv-i-dir-file

fix tests/mv/i-5.sh
This commit is contained in:
Daniel Hofstetter 2023-05-04 13:43:05 +02:00 committed by GitHub
commit 4ee1118061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -292,7 +292,7 @@ fn exec(files: &[OsString], b: &Behavior) -> UResult<()> {
OverwriteMode::NoClobber => return Ok(()),
OverwriteMode::Interactive => {
if !prompt_yes!("overwrite {}? ", target.quote()) {
return Ok(());
return Err(io::Error::new(io::ErrorKind::Other, "").into());
}
}
OverwriteMode::Force => {}

View file

@ -260,6 +260,26 @@ fn test_mv_interactive_with_dir_as_target() {
.no_stdout();
}
#[test]
fn test_mv_interactive_dir_to_file_not_affirmative() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_mv_interactive_dir_to_file_not_affirmative_dir";
let file = "test_mv_interactive_dir_to_file_not_affirmative_file";
at.mkdir(dir);
at.touch(file);
ucmd.arg(dir)
.arg(file)
.arg("-i")
.pipe_in("n")
.fails()
.no_stdout();
assert!(at.dir_exists(dir));
}
#[test]
fn test_mv_arg_update_interactive() {
let (at, mut ucmd) = at_and_ucmd!();