mirror of
https://github.com/uutils/coreutils
synced 2024-11-05 14:21:32 +00:00
mv: write test for multiple update args
This commit is contained in:
parent
918c36b485
commit
8ad2fa3cc1
1 changed files with 56 additions and 0 deletions
|
@ -787,6 +787,62 @@ fn test_mv_arg_update_older_dest_not_older() {
|
|||
assert_eq!(at.read(new), new_content)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_update_none_then_all() {
|
||||
// take last if multiple update args are supplied,
|
||||
// update=all wins in this case
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let old = "test_cp_arg_update_none_then_all_file1";
|
||||
let new = "test_cp_arg_update_none_then_all_file2";
|
||||
let old_content = "old content\n";
|
||||
let new_content = "new content\n";
|
||||
|
||||
at.write(old, old_content);
|
||||
|
||||
sleep(Duration::from_secs(1));
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(old)
|
||||
.arg(new)
|
||||
.arg("--update=none")
|
||||
.arg("--update=all")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
|
||||
assert_eq!(at.read(new), "old content\n")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_update_all_then_none() {
|
||||
// take last if multiple update args are supplied,
|
||||
// update=none wins in this case
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let old = "test_cp_arg_update_all_then_none_file1";
|
||||
let new = "test_cp_arg_update_all_then_none_file2";
|
||||
let old_content = "old content\n";
|
||||
let new_content = "new content\n";
|
||||
|
||||
at.write(old, old_content);
|
||||
|
||||
sleep(Duration::from_secs(1));
|
||||
|
||||
at.write(new, new_content);
|
||||
|
||||
ucmd.arg(old)
|
||||
.arg(new)
|
||||
.arg("--update=all")
|
||||
.arg("--update=none")
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
|
||||
assert_eq!(at.read(new), "new content\n")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mv_arg_update_older_dest_older() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
Loading…
Reference in a new issue