diff --git a/tests/dateutils.rs b/tests/dateutils.rs index d7e0dc8ad6..dec6bfe117 100644 --- a/tests/dateutils.rs +++ b/tests/dateutils.rs @@ -77,7 +77,8 @@ fn try_verify_against_date_command() { #[cfg(target_os = "linux")] fn verify_against_date_command_format_local(path: &'static str, dt: NaiveDateTime) { - let required_format = "d%d D%D F%F H%H I%I j%j k%k l%l m%m M%M S%S T%T u%u U%U w%w W%W X%X y%y Y%Y z%:z"; + let required_format = + "d%d D%D F%F H%H I%I j%j k%k l%l m%m M%M S%S T%T u%u U%U w%w W%W X%X y%y Y%Y z%:z"; // a%a - depends from localization // A%A - depends from localization // b%b - depends from localization @@ -89,17 +90,26 @@ fn verify_against_date_command_format_local(path: &'static str, dt: NaiveDateTim // x%x - fails, date is dd/mm/yyyy, chrono is dd/mm/yy, same as %D // Z%Z - too many ways to represent it, will most likely fail - let output = process::Command::new(path) .arg("-d") - .arg(format!("{}-{:02}-{:02} {:02}:{:02}:{:02}", dt.year(), dt.month(), dt.day(), dt.hour(), dt.minute(), dt.second())) + .arg(format!( + "{}-{:02}-{:02} {:02}:{:02}:{:02}", + dt.year(), + dt.month(), + dt.day(), + dt.hour(), + dt.minute(), + dt.second() + )) .arg(format!("+{}", required_format)) .output() .unwrap(); let date_command_str = String::from_utf8(output.stdout).unwrap(); let date = NaiveDate::from_ymd_opt(dt.year(), dt.month(), dt.day()).unwrap(); - let ldt = Local.from_local_datetime(&date.and_hms_opt(dt.hour(), dt.minute(), dt.second()).unwrap()).unwrap(); + let ldt = Local + .from_local_datetime(&date.and_hms_opt(dt.hour(), dt.minute(), dt.second()).unwrap()) + .unwrap(); let formated_date = format!("{}\n", ldt.format(required_format)); assert_eq!(date_command_str, formated_date); }