Skip to content

Commit b8d81ad

Browse files
committed
du/test_du: Fix ctime fallback on Windows, and test
1 parent 96438f2 commit b8d81ad

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/uu/du/src/du.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ impl StatPrinter {
531531
uucore::time::format_system_time(&mut stdout(), time, &self.time_format, true)?;
532532
print!("\t");
533533
} else {
534-
println!("???\t");
534+
print!("???\t");
535535
}
536536
}
537537

tests/by-util/test_du.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,9 @@ fn test_du_time() {
640640
let re_change_birth =
641641
Regex::new(r"0\t[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}\tdate_test").unwrap();
642642
let result = ts.ucmd().arg("--time=ctime").arg("date_test").succeeds();
643+
#[cfg(windows)]
644+
result.stdout_only("0\t???\tdate_test\n"); // ctime not supported on Windows
645+
#[cfg(not(windows))]
643646
result.stdout_matches(&re_change_birth);
644647

645648
if birth_supported() {

0 commit comments

Comments
 (0)