Skip to content

Commit

Permalink
fixup! cp: correctly copy ancestor dirs in --parents mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels authored and sylvestre committed Sep 5, 2022
1 parent 3ab224e commit 6a18e00
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1961,10 +1961,22 @@ fn test_cp_parents_2_dirs() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir_all("a/b/c");
at.mkdir("d");
// TODO We should iron out exactly what the `--verbose` behavior
// should be on Windows. Currently, we have it printing, for
// example,
//
// a/b -> d\a/b
//
// Should the path separators all be forward slashes? All
// backslashes?
#[cfg(not(windows))]
let expected_stdout = "a -> d/a\na/b -> d/a/b\n'a/b/c' -> 'd/a/b/c'\n";
#[cfg(windows)]
let expected_stdout = "a -> d\\a\na/b -> d\\a/b\n'a/b/c' -> 'd\\a/b\\c'\n";
ucmd.args(&["--verbose", "-a", "--parents", "a/b/c", "d"])
.succeeds()
.no_stderr()
.stdout_is("a -> d/a\na/b -> d/a/b\n'a/b/c' -> 'd/a/b/c'\n");
.stdout_is(expected_stdout);
assert!(at.dir_exists("d/a/b/c"));
}

Expand Down

0 comments on commit 6a18e00

Please sign in to comment.