1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

mv: remove "sleep" in tests

This commit is contained in:
Daniel Hofstetter 2024-03-28 16:02:54 +01:00
parent 881044aef0
commit 9f07bf8809

View file

@ -6,8 +6,7 @@
// spell-checker:ignore mydir // spell-checker:ignore mydir
use crate::common::util::TestScenario; use crate::common::util::TestScenario;
use filetime::FileTime; use filetime::FileTime;
use std::thread::sleep; use std::io::Write;
use std::time::Duration;
#[test] #[test]
fn test_mv_invalid_arg() { fn test_mv_invalid_arg() {
@ -974,9 +973,9 @@ fn test_mv_arg_update_older_dest_not_older() {
let old_content = "file1 content\n"; let old_content = "file1 content\n";
let new_content = "file2 content\n"; let new_content = "file2 content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);
@ -1001,9 +1000,9 @@ fn test_mv_arg_update_none_then_all() {
let old_content = "old content\n"; let old_content = "old content\n";
let new_content = "new content\n"; let new_content = "new content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);
@ -1029,9 +1028,9 @@ fn test_mv_arg_update_all_then_none() {
let old_content = "old content\n"; let old_content = "old content\n";
let new_content = "new content\n"; let new_content = "new content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);
@ -1055,9 +1054,9 @@ fn test_mv_arg_update_older_dest_older() {
let old_content = "file1 content\n"; let old_content = "file1 content\n";
let new_content = "file2 content\n"; let new_content = "file2 content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);
@ -1081,9 +1080,9 @@ fn test_mv_arg_update_short_overwrite() {
let old_content = "file1 content\n"; let old_content = "file1 content\n";
let new_content = "file2 content\n"; let new_content = "file2 content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);
@ -1107,9 +1106,9 @@ fn test_mv_arg_update_short_no_overwrite() {
let old_content = "file1 content\n"; let old_content = "file1 content\n";
let new_content = "file2 content\n"; let new_content = "file2 content\n";
at.write(old, old_content); let mut f = at.make_file(old);
f.write_all(old_content.as_bytes()).unwrap();
sleep(Duration::from_secs(1)); f.set_modified(std::time::UNIX_EPOCH).unwrap();
at.write(new, new_content); at.write(new, new_content);