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

Merge pull request #6890 from cakebaker/cp_remove_sleep_in_tests

cp: remove some `sleep()` calls in tests
This commit is contained in:
Sylvestre Ledru 2024-11-26 11:11:38 +01:00 committed by GitHub
commit 906a6330f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@ use crate::common::util::TestScenario;
#[cfg(not(windows))] #[cfg(not(windows))]
use std::fs::set_permissions; use std::fs::set_permissions;
use std::io::Write;
#[cfg(not(windows))] #[cfg(not(windows))]
use std::os::unix::fs; use std::os::unix::fs;
@ -447,9 +448,9 @@ fn test_cp_arg_update_older_dest_older_than_src() {
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);
@ -473,9 +474,9 @@ fn test_cp_arg_update_short_no_overwrite() {
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);
@ -499,9 +500,9 @@ fn test_cp_arg_update_short_overwrite() {
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);
@ -526,9 +527,9 @@ fn test_cp_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);
@ -554,9 +555,9 @@ fn test_cp_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);