fix datetime tests
This commit is contained in:
parent
56166018a5
commit
54f6ce82a3
1 changed files with 32 additions and 32 deletions
|
@ -329,9 +329,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_rfc_strict() {
|
fn test_section_rfc_strict() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("Fri, 21 Nov 1997 09:55:06 -0600"),
|
section(b"Fri, 21 Nov 1997 09:55:06 -0600"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::west_opt(6 * HOUR)
|
FixedOffset::west_opt(6 * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -345,9 +345,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_received() {
|
fn test_section_received() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("Sun, 18 Jun 2023 15:39:08 +0200 (CEST)"),
|
section(b"Sun, 18 Jun 2023 15:39:08 +0200 (CEST)"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(2 * HOUR)
|
FixedOffset::east_opt(2 * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -367,10 +367,10 @@ mod tests {
|
||||||
Feb
|
Feb
|
||||||
1969
|
1969
|
||||||
23:32
|
23:32
|
||||||
-0330 (Newfoundland Time)"#
|
-0330 (Newfoundland Time)"#.as_bytes()
|
||||||
),
|
),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::west_opt(3 * HOUR + 30 * MIN)
|
FixedOffset::west_opt(3 * HOUR + 30 * MIN)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -384,9 +384,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_rfc_obs() {
|
fn test_section_rfc_obs() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 97 09:55:06 GMT"),
|
section(b"21 Nov 97 09:55:06 GMT"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -400,9 +400,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_3digit_year() {
|
fn test_section_3digit_year() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 103 09:55:06 UT"),
|
section(b"21 Nov 103 09:55:06 UT"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -416,9 +416,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_rfc_obs_ws() {
|
fn test_section_rfc_obs_ws() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("Fri, 21 Nov 1997 09(comment): 55 : 06 -0600"),
|
section(b"Fri, 21 Nov 1997 09(comment): 55 : 06 -0600"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::west_opt(6 * HOUR)
|
FixedOffset::west_opt(6 * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -432,9 +432,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_2digit_year() {
|
fn test_section_2digit_year() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 23 09:55:06Z"),
|
section(b"21 Nov 23 09:55:06Z"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -452,9 +452,9 @@ mod tests {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.for_each(|(i, x)| {
|
.for_each(|(i, x)| {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section(format!("1 Jan 22 08:00:00 {}", x).as_str()),
|
section(format!("1 Jan 22 08:00:00 {}", x).as_bytes()),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt((i as i32 + 1) * HOUR)
|
FixedOffset::east_opt((i as i32 + 1) * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -473,9 +473,9 @@ mod tests {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.for_each(|(i, x)| {
|
.for_each(|(i, x)| {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section(format!("1 Jan 22 08:00:00 {}", x).as_str()),
|
section(format!("1 Jan 22 08:00:00 {}", x).as_bytes()),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::west_opt((i as i32 + 1) * HOUR)
|
FixedOffset::west_opt((i as i32 + 1) * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -490,9 +490,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_gmt() {
|
fn test_section_gmt() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 +0000"),
|
section(b"21 Nov 2023 07:07:07 +0000"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -502,9 +502,9 @@ mod tests {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 -0000"),
|
section(b"21 Nov 2023 07:07:07 -0000"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -514,9 +514,9 @@ mod tests {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 Z"),
|
section(b"21 Nov 2023 07:07:07 Z"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -526,9 +526,9 @@ mod tests {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 GMT"),
|
section(b"21 Nov 2023 07:07:07 GMT"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -538,9 +538,9 @@ mod tests {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 UT"),
|
section(b"21 Nov 2023 07:07:07 UT"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -550,9 +550,9 @@ mod tests {
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 07:07:07 UTC"),
|
section(b"21 Nov 2023 07:07:07 UTC"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::east_opt(0)
|
FixedOffset::east_opt(0)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -566,9 +566,9 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_section_usa() {
|
fn test_section_usa() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section("21 Nov 2023 4:4:4 CST"),
|
section(b"21 Nov 2023 4:4:4 CST"),
|
||||||
Ok((
|
Ok((
|
||||||
"",
|
&b""[..],
|
||||||
Some(
|
Some(
|
||||||
FixedOffset::west_opt(6 * HOUR)
|
FixedOffset::west_opt(6 * HOUR)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in a new issue