1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

cp: make test for interactive mode more specific

This commit is contained in:
Jeffrey Finkelstein 2022-10-10 10:41:43 -04:00
parent bb27734f6a
commit cee6c25cc4

View file

@ -217,15 +217,18 @@ fn test_cp_target_directory_is_file() {
#[test] #[test]
fn test_cp_arg_interactive() { fn test_cp_arg_interactive() {
new_ucmd!() let (at, mut ucmd) = at_and_ucmd!();
.arg(TEST_HELLO_WORLD_SOURCE) at.touch("a");
.arg(TEST_HOW_ARE_YOU_SOURCE) at.touch("b");
.arg("-i") // TODO The prompt in GNU cp is different, and it doesn't have the
// response either.
//
// See <https://github.com/uutils/coreutils/issues/4023>.
ucmd.args(&["-i", "a", "b"])
.pipe_in("N\n") .pipe_in("N\n")
.succeeds() .succeeds()
.no_stdout() .no_stdout()
.stderr_contains(format!("overwrite '{}'?", TEST_HOW_ARE_YOU_SOURCE)) .stderr_is("cp: overwrite 'b'? [y/N]: cp: Not overwriting 'b' at user request\n");
.stderr_contains("Not overwriting");
} }
#[test] #[test]