Skip to content

Commit 97da29b

Browse files
BenWiederhakesylvestre
authored andcommitted
cp: fix flaky test test_cp_arg_interactive_update, document adjacent bug
1 parent 372cd52 commit 97da29b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/by-util/test_cp.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,30 @@ fn test_cp_arg_interactive_update() {
505505
at.touch("a");
506506
at.touch("b");
507507
ucmd.args(&["-i", "-u", "a", "b"])
508-
.pipe_in("N\n")
508+
.pipe_in("")
509509
.succeeds()
510510
.no_stdout();
511+
let (at, mut ucmd) = at_and_ucmd!();
512+
at.touch("a");
513+
at.touch("b");
514+
ucmd.args(&["-i", "-u", "a", "b"]).succeeds().no_stdout();
515+
}
516+
517+
#[test]
518+
#[cfg(not(any(target_os = "android", target_os = "freebsd")))]
519+
#[ignore = "known issue #6019"]
520+
fn test_cp_arg_interactive_update_newer() {
521+
// -u -i *WILL* show the prompt to validate the override.
522+
// Therefore, the error code depends on the prompt response.
523+
let (at, mut ucmd) = at_and_ucmd!();
524+
at.touch("b");
525+
at.touch("a");
526+
ucmd.args(&["-i", "-u", "a", "b"])
527+
.pipe_in("N\n")
528+
.fails()
529+
.code_is(1)
530+
.no_stdout()
531+
.stderr_is("cp: overwrite 'b'? ");
511532
}
512533

513534
#[test]

0 commit comments

Comments
 (0)