mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
du: fix --time behavior
This commit is contained in:
parent
eb6e6d49eb
commit
05aeaf3061
2 changed files with 62 additions and 23 deletions
|
@ -240,18 +240,37 @@ fn test_du_time() {
|
|||
scene
|
||||
.ccmd("touch")
|
||||
.arg("-a")
|
||||
.arg("-m")
|
||||
.arg("-t")
|
||||
.arg("201505150000")
|
||||
.arg("date_test")
|
||||
.succeeds();
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--time")
|
||||
.ccmd("touch")
|
||||
.arg("-m")
|
||||
.arg("-t")
|
||||
.arg("201606160000")
|
||||
.arg("date_test")
|
||||
.succeeds()
|
||||
.stdout_only("0\t2015-05-15 00:00\tdate_test\n");
|
||||
.succeeds();
|
||||
|
||||
let result = scene.ucmd().arg("--time").arg("date_test").succeeds();
|
||||
result.stdout_only("0\t2016-06-16 00:00\tdate_test\n");
|
||||
|
||||
let result = scene.ucmd().arg("--time=atime").arg("date_test").succeeds();
|
||||
result.stdout_only("0\t2015-05-15 00:00\tdate_test\n");
|
||||
|
||||
let result = scene.ucmd().arg("--time=ctime").arg("date_test").succeeds();
|
||||
result.stdout_only("0\t2016-06-16 00:00\tdate_test\n");
|
||||
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
{
|
||||
use regex::Regex;
|
||||
|
||||
let re_birth =
|
||||
Regex::new(r"0\t[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\tdate_test").unwrap();
|
||||
let result = scene.ucmd().arg("--time=birth").arg("date_test").succeeds();
|
||||
result.stdout_matches(&re_birth);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue