du/test_du: Fix ctime fallback on Windows, and test

This commit is contained in:
Nicolas Boichat
2025-07-27 12:57:28 +08:00
parent 96438f2086
commit b8d81adcff
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -531,7 +531,7 @@ impl StatPrinter {
uucore::time::format_system_time(&mut stdout(), time, &self.time_format, true)?;
print!("\t");
} else {
println!("???\t");
print!("???\t");
}
}
+3
View File
@@ -640,6 +640,9 @@ fn test_du_time() {
let re_change_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 = ts.ucmd().arg("--time=ctime").arg("date_test").succeeds();
#[cfg(windows)]
result.stdout_only("0\t???\tdate_test\n"); // ctime not supported on Windows
#[cfg(not(windows))]
result.stdout_matches(&re_change_birth);
if birth_supported() {