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

Merge pull request #6880 from cakebaker/mv_remove_sleep_in_tests

mv: remove `sleep` in tests
This commit is contained in:
Sylvestre Ledru 2024-11-25 09:58:43 +01:00 committed by GitHub
commit c7798d5d20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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