Allow mv multiple files at once (#6103)

* Allow mv multiple files at once

* Expand dots in mv src + dst
This commit is contained in:
Matthew Ma
2022-07-23 05:51:41 -07:00
committed by GitHub
parent 8a0bd20e84
commit 7d46177cf3
3 changed files with 159 additions and 103 deletions

View File

@ -22,6 +22,36 @@ fn moves_a_file() {
})
}
#[test]
fn moves_multiple_files() {
Playground::setup("mv_test_1_1", |dirs, sandbox| {
sandbox
.mkdir("expected")
.with_files(vec![EmptyFile("andres.txt"), EmptyFile("yehuda.txt")])
.within("foo")
.with_files(vec![EmptyFile("bar.txt")]);
let original_1 = dirs.test().join("andres.txt");
let original_2 = dirs.test().join("yehuda.txt");
let original_3 = dirs.test().join("foo/bar.txt");
let expected_1 = dirs.test().join("expected/andres.txt");
let expected_2 = dirs.test().join("expected/yehuda.txt");
let expected_3 = dirs.test().join("expected/bar.txt");
nu!(
cwd: dirs.test(),
"mv andres.txt yehuda.txt foo/bar.txt expected"
);
assert!(!original_1.exists());
assert!(!original_2.exists());
assert!(!original_3.exists());
assert!(expected_1.exists());
assert!(expected_2.exists());
assert!(expected_3.exists());
})
}
#[test]
fn overwrites_if_moving_to_existing_file() {
Playground::setup("mv_test_2", |dirs, sandbox| {