|
6 | 6 | // spell-checker:ignore (words) egid euid pseudofloat
|
7 | 7 |
|
8 | 8 | use crate::common::util::TestScenario;
|
9 |
| -use std::thread::sleep; |
10 | 9 |
|
11 | 10 | #[test]
|
12 | 11 | fn test_empty_test_equivalent_to_false() {
|
@@ -380,28 +379,28 @@ fn test_same_device_inode() {
|
380 | 379 | fn test_newer_file() {
|
381 | 380 | let scenario = TestScenario::new(util_name!());
|
382 | 381 |
|
383 |
| - scenario.fixtures.touch("regular_file"); |
384 |
| - sleep(std::time::Duration::from_millis(100)); |
| 382 | + let older_file = scenario.fixtures.make_file("older_file"); |
| 383 | + older_file.set_modified(std::time::UNIX_EPOCH).unwrap(); |
385 | 384 | scenario.fixtures.touch("newer_file");
|
386 | 385 |
|
387 | 386 | scenario
|
388 | 387 | .ucmd()
|
389 |
| - .args(&["newer_file", "-nt", "regular_file"]) |
| 388 | + .args(&["newer_file", "-nt", "older_file"]) |
390 | 389 | .succeeds();
|
391 | 390 |
|
392 | 391 | scenario
|
393 | 392 | .ucmd()
|
394 |
| - .args(&["regular_file", "-nt", "newer_file"]) |
| 393 | + .args(&["older_file", "-nt", "newer_file"]) |
395 | 394 | .fails();
|
396 | 395 |
|
397 | 396 | scenario
|
398 | 397 | .ucmd()
|
399 |
| - .args(&["regular_file", "-ot", "newer_file"]) |
| 398 | + .args(&["older_file", "-ot", "newer_file"]) |
400 | 399 | .succeeds();
|
401 | 400 |
|
402 | 401 | scenario
|
403 | 402 | .ucmd()
|
404 |
| - .args(&["newer_file", "-ot", "regular_file"]) |
| 403 | + .args(&["newer_file", "-ot", "older_file"]) |
405 | 404 | .fails();
|
406 | 405 | }
|
407 | 406 |
|
@@ -946,12 +945,15 @@ fn test_bracket_syntax_version() {
|
946 | 945 | fn test_file_N() {
|
947 | 946 | let scene = TestScenario::new(util_name!());
|
948 | 947 | let at = &scene.fixtures;
|
949 |
| - scene.ucmd().args(&["-N", "regular_file"]).fails(); |
| 948 | + |
| 949 | + let f = at.make_file("file"); |
| 950 | + f.set_modified(std::time::UNIX_EPOCH).unwrap(); |
| 951 | + |
| 952 | + scene.ucmd().args(&["-N", "file"]).fails(); |
950 | 953 | // The file will have different create/modified data
|
951 | 954 | // so, test -N will return 0
|
952 |
| - sleep(std::time::Duration::from_millis(100)); |
953 |
| - at.touch("regular_file"); |
954 |
| - scene.ucmd().args(&["-N", "regular_file"]).succeeds(); |
| 955 | + at.touch("file"); |
| 956 | + scene.ucmd().args(&["-N", "file"]).succeeds(); |
955 | 957 | }
|
956 | 958 |
|
957 | 959 | #[test]
|
|
0 commit comments