From 3338ff1e6c763587c4657dad0e1ea7c419a2bba9 Mon Sep 17 00:00:00 2001 From: fdai7375 Date: Thu, 2 Feb 2023 20:52:46 +0100 Subject: [PATCH] test: add format time RFC2822 test --- src/builtins/time.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/builtins/time.rs b/src/builtins/time.rs index d1cb056..dbf47af 100644 --- a/src/builtins/time.rs +++ b/src/builtins/time.rs @@ -37,4 +37,13 @@ mod tests { fn test_time() { assert_eq!(Time.execute(&mut BuiltinConfig::new(), vec![]), Ok(())) } + + #[test] + fn test_format_time_rfc2822() { + let time = chrono::Utc.with_ymd_and_hms(6969, 4, 20, 4, 20, 9).unwrap(); + assert_eq!( + format_time(time, "RFC2822"), + "Thu, 20 Apr 6969 04:20:09 +0000" + ) + } }