1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2025-04-08 02:49:52 +00:00

Fix a few errors with time related tests from the time upgrade

This commit is contained in:
kevinpoitra 2020-01-06 05:42:32 -06:00
parent bd4807f4d3
commit 52018a6c47
3 changed files with 11 additions and 11 deletions

View file

@ -992,7 +992,7 @@ impl<'a, 'b> PartialEq<Cookie<'b>> for Cookie<'a> {
#[cfg(test)]
mod tests {
use super::{Cookie, SameSite};
use time::{OffsetDateTime, PrimitiveDateTime, UtcOffset};
use time::{PrimitiveDateTime, UtcOffset};
#[test]
fn format() {

View file

@ -216,7 +216,7 @@ where
#[cfg(test)]
mod tests {
use super::{Cookie, SameSite};
use time::{Duration, OffsetDateTime, PrimitiveDateTime, UtcOffset};
use time::{Duration, PrimitiveDateTime, UtcOffset};
macro_rules! assert_eq_parse {
($string:expr, $expected:expr) => {

View file

@ -74,28 +74,28 @@ impl From<HttpDate> for SystemTime {
#[cfg(test)]
mod tests {
use super::HttpDate;
use time::{OffsetDateTime, Date, Time};
const NOV_07: HttpDate = HttpDate(OffsetDateTime::new(
Date::try_from_ymd(1994, 11, 7).unwrap(),
Time::try_from_hms(8, 48, 37).unwrap()
));
use time::{PrimitiveDateTime, Date, Time, UtcOffset};
#[test]
fn test_date() {
let nov_07 = HttpDate(PrimitiveDateTime::new(
Date::try_from_ymd(1994, 11, 7).unwrap(),
Time::try_from_hms(8, 48, 37).unwrap()
).using_offset(UtcOffset::UTC));
assert_eq!(
"Sun, 07 Nov 1994 08:48:37 GMT".parse::<HttpDate>().unwrap(),
NOV_07
nov_07
);
assert_eq!(
"Sunday, 07-Nov-94 08:48:37 GMT"
.parse::<HttpDate>()
.unwrap(),
NOV_07
nov_07
);
assert_eq!(
"Sun Nov 7 08:48:37 1994".parse::<HttpDate>().unwrap(),
NOV_07
nov_07
);
assert!("this-is-no-date".parse::<HttpDate>().is_err());
}