Skip to content

Commit 935e7b5

Browse files
committed
Parse to NaiveDateTime in parse_rfc850 test
The format string doesn't contain any offset info.
1 parent d56049f commit 935e7b5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/format/parse.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ fn parse_rfc3339_relaxed<'a>(parsed: &mut Parsed, mut s: &'a str) -> ParseResult
598598
#[cfg(test)]
599599
mod tests {
600600
use crate::format::*;
601-
use crate::{DateTime, FixedOffset, TimeZone, Timelike, Utc};
601+
use crate::{DateTime, FixedOffset, NaiveDateTime, TimeZone, Timelike, Utc};
602602

603603
macro_rules! parsed {
604604
($($k:ident: $v:expr),*) => (#[allow(unused_mut)] {
@@ -1704,7 +1704,10 @@ mod tests {
17041704
assert_eq!(dt.format(RFC850_FMT).to_string(), "Sunday, 06-Nov-94 08:49:37 GMT");
17051705

17061706
// Check that it parses correctly
1707-
assert_eq!(Ok(dt), Utc.datetime_from_str("Sunday, 06-Nov-94 08:49:37 GMT", RFC850_FMT));
1707+
assert_eq!(
1708+
NaiveDateTime::parse_from_str("Sunday, 06-Nov-94 08:49:37 GMT", RFC850_FMT),
1709+
Ok(dt.naive_utc())
1710+
);
17081711

17091712
// Check that the rest of the weekdays parse correctly (this test originally failed because
17101713
// Sunday parsed incorrectly).
@@ -1736,7 +1739,7 @@ mod tests {
17361739
];
17371740

17381741
for val in &testdates {
1739-
assert_eq!(Ok(val.0), Utc.datetime_from_str(val.1, RFC850_FMT));
1742+
assert_eq!(NaiveDateTime::parse_from_str(val.1, RFC850_FMT), Ok(val.0.naive_utc()));
17401743
}
17411744

17421745
let test_dates_fail = [
@@ -1755,7 +1758,7 @@ mod tests {
17551758
];
17561759

17571760
for val in &test_dates_fail {
1758-
assert!(Utc.datetime_from_str(val, RFC850_FMT).is_err());
1761+
assert!(NaiveDateTime::parse_from_str(val, RFC850_FMT).is_err());
17591762
}
17601763
}
17611764

0 commit comments

Comments
 (0)