mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp -i: adjust the behavior to match the GNU change
Just like mv Note that cp -i -u won't show the overwrite question Matches the change upstream 7a69df88999bedd8e9fccf9f3dfa9ac6907fab66
This commit is contained in:
parent
0d5daacf99
commit
d0a4059f34
2 changed files with 30 additions and 2 deletions
|
@ -234,6 +234,16 @@ fn test_cp_arg_update_interactive() {
|
|||
.no_stderr();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_update_interactive_error() {
|
||||
new_ucmd!()
|
||||
.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.arg(TEST_HOW_ARE_YOU_SOURCE)
|
||||
.arg("-i")
|
||||
.fails()
|
||||
.no_stdout();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_interactive() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
@ -241,11 +251,24 @@ fn test_cp_arg_interactive() {
|
|||
at.touch("b");
|
||||
ucmd.args(&["-i", "a", "b"])
|
||||
.pipe_in("N\n")
|
||||
.succeeds()
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_is("cp: overwrite 'b'? ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_interactive_update() {
|
||||
// -u -i won't show the prompt to validate the override or not
|
||||
// Therefore, the error code will be 0
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
at.touch("a");
|
||||
at.touch("b");
|
||||
ucmd.args(&["-i", "-u", "a", "b"])
|
||||
.pipe_in("N\n")
|
||||
.succeeds()
|
||||
.no_stdout();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_cp_arg_link() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue