From 097ab04a69b0ab147904a401034f341cd09ebb4a Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 28 Mar 2016 09:57:29 -0700 Subject: [PATCH] Update RFC850 test to check all weekdays --- src/format/parse.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/format/parse.rs b/src/format/parse.rs index 316cfac..13c44ab 100644 --- a/src/format/parse.rs +++ b/src/format/parse.rs @@ -652,6 +652,21 @@ fn parse_rfc850() { // Check that it parses correctly assert_eq!(Ok(dt), UTC.datetime_from_str("Sunday, 06-Nov-94 08:49:37 GMT", RFC850_FMT)); + + // Check that the rest of the weekdays parse correctly (this test originally failed because + // Sunday parsed incorrectly). + let testdates = [ + (UTC.ymd(1994, 11, 7).and_hms(8, 49, 37), "Monday, 07-Nov-94 08:49:37 GMT"), + (UTC.ymd(1994, 11, 8).and_hms(8, 49, 37), "Tuesday, 08-Nov-94 08:49:37 GMT"), + (UTC.ymd(1994, 11, 9).and_hms(8, 49, 37), "Wednesday, 09-Nov-94 08:49:37 GMT"), + (UTC.ymd(1994, 11, 10).and_hms(8, 49, 37), "Thursday, 10-Nov-94 08:49:37 GMT"), + (UTC.ymd(1994, 11, 11).and_hms(8, 49, 37), "Friday, 11-Nov-94 08:49:37 GMT"), + (UTC.ymd(1994, 11, 12).and_hms(8, 49, 37), "Saturday, 12-Nov-94 08:49:37 GMT"), + ]; + + for val in &testdates { + assert_eq!(Ok(val.0), UTC.datetime_from_str(val.1, RFC850_FMT)); + } } #[cfg(test)]