mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests/cp: add test for cp-parents.sh
This commit is contained in:
parent
0ea3a735ca
commit
147f83f68a
1 changed files with 45 additions and 0 deletions
|
@ -26,6 +26,7 @@ use std::fs as std_fs;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use uucore::display::Quotable;
|
||||||
|
|
||||||
static TEST_EXISTING_FILE: &str = "existing_file.txt";
|
static TEST_EXISTING_FILE: &str = "existing_file.txt";
|
||||||
static TEST_HELLO_WORLD_SOURCE: &str = "hello_world.txt";
|
static TEST_HELLO_WORLD_SOURCE: &str = "hello_world.txt";
|
||||||
|
@ -1752,3 +1753,47 @@ fn test_copy_same_symlink_no_dereference_dangling() {
|
||||||
at.relative_symlink_file("t", "b");
|
at.relative_symlink_file("t", "b");
|
||||||
ucmd.args(&["-d", "a", "b"]).succeeds();
|
ucmd.args(&["-d", "a", "b"]).succeeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore = "issue #3332"]
|
||||||
|
fn test_cp_parents_2() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
at.mkdir_all("a/b");
|
||||||
|
at.touch("a/b/c");
|
||||||
|
at.mkdir("d");
|
||||||
|
ucmd.args(&["--verbose", "-a", "--parents", "a/b/c", "d"])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is(format!(
|
||||||
|
"{} -> {}\n{} -> {}\n{} -> {}\n",
|
||||||
|
"a",
|
||||||
|
path_concat!("d", "a"),
|
||||||
|
path_concat!("a", "b"),
|
||||||
|
path_concat!("d", "a", "b"),
|
||||||
|
path_concat!("a", "b", "c").quote(),
|
||||||
|
path_concat!("d", "a", "b", "c").quote()
|
||||||
|
));
|
||||||
|
assert!(at.file_exists("d/a/b/c"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore = "issue #3332"]
|
||||||
|
fn test_cp_parents_2_link() {
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
at.mkdir_all("a/b");
|
||||||
|
at.touch("a/b/c");
|
||||||
|
at.mkdir("d");
|
||||||
|
at.relative_symlink_file("b", "a/link");
|
||||||
|
ucmd.args(&["--verbose", "-a", "--parents", "a/link/c", "d"])
|
||||||
|
.succeeds()
|
||||||
|
.stdout_is(format!(
|
||||||
|
"{} -> {}\n{} -> {}\n{} -> {}\n",
|
||||||
|
"a",
|
||||||
|
path_concat!("d", "a"),
|
||||||
|
path_concat!("a", "link"),
|
||||||
|
path_concat!("d", "a", "link"),
|
||||||
|
path_concat!("a", "link", "c").quote(),
|
||||||
|
path_concat!("d", "a", "link", "c").quote()
|
||||||
|
));
|
||||||
|
assert!(at.dir_exists("d/a/link") && !at.symlink_exists("d/a/link"));
|
||||||
|
assert!(at.file_exists("d/a/link/c"));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue