mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
This reverts commit 580062228b
.
This commit is contained in:
parent
c3fd27c225
commit
8e5f28839c
13 changed files with 123 additions and 161 deletions
|
@ -8,8 +8,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::time::SystemTime;
|
||||
|
||||
use cookie::Cookie;
|
||||
use headers::ContentType;
|
||||
use http::header::HeaderMap;
|
||||
|
@ -17,6 +15,7 @@ use hyper::{Method, StatusCode, Uri};
|
|||
use hyper_serde::{De, Ser, Serde};
|
||||
use mime::Mime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::Tm;
|
||||
|
||||
fn is_supported<T>()
|
||||
where
|
||||
|
@ -34,6 +33,6 @@ fn supported() {
|
|||
is_supported::<Method>();
|
||||
is_supported::<Mime>();
|
||||
is_supported::<StatusCode>();
|
||||
is_supported::<SystemTime>();
|
||||
is_supported::<Tm>();
|
||||
is_supported::<Uri>();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ use http::StatusCode;
|
|||
use hyper::{Method, Uri};
|
||||
use hyper_serde::{De, Ser};
|
||||
use serde_test::{assert_de_tokens, assert_ser_tokens, Token};
|
||||
use time::Duration;
|
||||
|
||||
#[test]
|
||||
fn test_content_type() {
|
||||
|
@ -31,7 +32,7 @@ fn test_cookie() {
|
|||
// string with a bunch of indices in it which apparently is different from the exact same
|
||||
// cookie but parsed as a bunch of strings.
|
||||
let cookie: Cookie = Cookie::build("Hello", "World!")
|
||||
.max_age(time::Duration::seconds(42))
|
||||
.max_age(Duration::seconds(42))
|
||||
.domain("servo.org")
|
||||
.path("/")
|
||||
.secure(true)
|
||||
|
@ -111,18 +112,14 @@ fn test_raw_status() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_system_time_serialization() {
|
||||
use std::time::SystemTime;
|
||||
fn test_tm() {
|
||||
use time::strptime;
|
||||
|
||||
use chrono::{NaiveDateTime, TimeZone, Utc};
|
||||
let time = strptime("2017-02-22T12:03:31Z", "%Y-%m-%dT%H:%M:%SZ").unwrap();
|
||||
let tokens = &[Token::Str("2017-02-22T12:03:31Z")];
|
||||
|
||||
let time = SystemTime::from(Utc.from_utc_datetime(
|
||||
&NaiveDateTime::parse_from_str("2023-01-15T12:53:31Z", "%Y-%m-%dT%H:%M:%SZ").unwrap(),
|
||||
));
|
||||
let tokens = &[Token::Str("2023-01-15T12:53:31Z")];
|
||||
|
||||
assert_de_tokens(&De::new(time), tokens);
|
||||
assert_ser_tokens(&Ser::new(&time), tokens);
|
||||
assert_de_tokens(&De::new(time), tokens);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue