Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jun 12, 2023
1 parent 8ebbb73 commit 438d354
Showing 1 changed file with 74 additions and 74 deletions.
148 changes: 74 additions & 74 deletions src/format/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,15 +899,15 @@ mod tests {
check!("+12:34:5", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12:34:56", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12:34:56:", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12 34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12 34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12 34", [fix!(TimezoneOffset)]; INVALID);
check!("+12 34", [fix!(TimezoneOffset)]; INVALID);
check!("12:34", [fix!(TimezoneOffset)]; INVALID);
check!("12:34:56", [fix!(TimezoneOffset)]; INVALID);
check!("+12::34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12: :34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12:::34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12::::34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12::34", [fix!(TimezoneOffset)]; offset: 45_240);
check!("+12::34", [fix!(TimezoneOffset)]; INVALID);
check!("+12: :34", [fix!(TimezoneOffset)]; INVALID);
check!("+12:::34", [fix!(TimezoneOffset)]; INVALID);
check!("+12::::34", [fix!(TimezoneOffset)]; INVALID);
check!("+12::34", [fix!(TimezoneOffset)]; INVALID);
check!("+12:34:56", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12:3456", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+1234:56", [fix!(TimezoneOffset)]; TOO_LONG);
Expand All @@ -928,22 +928,22 @@ mod tests {
check!("+00:99", [fix!(TimezoneOffset)]; OUT_OF_RANGE);
check!("#12:34", [fix!(TimezoneOffset)]; INVALID);
check!("+12:34 ", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12 34 ", [fix!(TimezoneOffset)]; TOO_LONG);
check!("+12 34 ", [fix!(TimezoneOffset)]; INVALID);
check!(" +12:34", [fix!(TimezoneOffset)]; offset: 45_240);
check!(" -12:34", [fix!(TimezoneOffset)]; offset: -45_240);
check!(" −12:34", [fix!(TimezoneOffset)]; offset: -45_240); // MINUS SIGN (U+2212)
check!("12:34 ", [fix!(TimezoneOffset)]; INVALID);
check!(" +12:34", [fix!(TimezoneOffset)]; offset: 45_240);
check!(" -12:34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("\t -12:34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12: 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 :34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 : 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 : 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 : 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12: 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 :34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12 : 34", [fix!(TimezoneOffset)]; offset: -45_240);
check!("-12: 34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 :34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 : 34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 : 34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 : 34", [fix!(TimezoneOffset)]; INVALID);
check!("-12: 34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 :34", [fix!(TimezoneOffset)]; INVALID);
check!("-12 : 34", [fix!(TimezoneOffset)]; INVALID);
check!(" 12:34", [fix!(TimezoneOffset)]; INVALID);
check!("", [fix!(TimezoneOffset)]; TOO_SHORT);
check!("+", [fix!(TimezoneOffset)]; TOO_SHORT);
Expand Down Expand Up @@ -989,14 +989,14 @@ mod tests {
check!("12345678", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+1", [fix!(TimezoneOffsetColon)]; TOO_SHORT);
check!("+12", [fix!(TimezoneOffsetColon)]; TOO_SHORT);
check!("+123", [fix!(TimezoneOffsetColon)]; TOO_SHORT);
check!("+1234", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("-1234", [fix!(TimezoneOffsetColon)]; offset: -45_240);
check!("−1234", [fix!(TimezoneOffsetColon)]; offset: -45_240); // MINUS SIGN (U+2212)
check!("+12345", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+123456", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+1234567", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+12345678", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+123", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+1234", [fix!(TimezoneOffsetColon)]; INVALID);
check!("-1234", [fix!(TimezoneOffsetColon)]; INVALID);
check!("−1234", [fix!(TimezoneOffsetColon)]; INVALID); // MINUS SIGN (U+2212)
check!("+12345", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+123456", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+1234567", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12345678", [fix!(TimezoneOffsetColon)]; INVALID);
check!("1:", [fix!(TimezoneOffsetColon)]; INVALID);
check!("12:", [fix!(TimezoneOffsetColon)]; INVALID);
check!("12:3", [fix!(TimezoneOffsetColon)]; INVALID);
Expand All @@ -1017,24 +1017,24 @@ mod tests {
check!("+12:34:56:7", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+12:34:56:78", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+12:3456", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+1234:56", [fix!(TimezoneOffsetColon)]; TOO_LONG);
check!("+1234:56", [fix!(TimezoneOffsetColon)]; INVALID);
check!("−12:34", [fix!(TimezoneOffsetColon)]; offset: -45_240); // MINUS SIGN (U+2212)
check!("−12 : 34", [fix!(TimezoneOffsetColon)]; offset: -45_240); // MINUS SIGN (U+2212)
check!("+12 :34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12: 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12: 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12 :34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("-12 : 34", [fix!(TimezoneOffsetColon)]; offset: -45_240);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12::34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12: :34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12:::34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12::::34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("+12::34", [fix!(TimezoneOffsetColon)]; offset: 45_240);
check!("−12 : 34", [fix!(TimezoneOffsetColon)]; INVALID); // MINUS SIGN (U+2212)
check!("+12 :34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12: 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12: 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 :34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("-12 : 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12::34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12: :34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12:::34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12::::34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12::34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("#1234", [fix!(TimezoneOffsetColon)]; INVALID);
check!("#12:34", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12:34 ", [fix!(TimezoneOffsetColon)]; TOO_LONG);
Expand All @@ -1046,7 +1046,7 @@ mod tests {
check!("", [fix!(TimezoneOffsetColon)]; TOO_SHORT);
check!("+", [fix!(TimezoneOffsetColon)]; TOO_SHORT);
check!(":", [fix!(TimezoneOffsetColon)]; INVALID);
check!("+12345", [fix!(TimezoneOffsetColon), num!(Day)]; offset: 45_240, day: 5);
check!("+12345", [fix!(TimezoneOffsetColon), num!(Day)]; INVALID);
check!("+12:345", [fix!(TimezoneOffsetColon), num!(Day)]; offset: 45_240, day: 5);
check!("+12:34:", [fix!(TimezoneOffsetColon), lit!(":")]; offset: 45_240);
check!("Z", [fix!(TimezoneOffsetColon)]; INVALID);
Expand Down Expand Up @@ -1104,21 +1104,21 @@ mod tests {
check!("+12:34:56:", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12:34:56:7", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12:34:56:78", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12::34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12::34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12:3456", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+1234:56", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12: 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 :34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12: 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 :34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12 : 34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("12:34 ", [fix!(TimezoneOffsetZ)]; INVALID);
check!(" 12:34", [fix!(TimezoneOffsetZ)]; INVALID);
check!("+12:34 ", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12 34 ", [fix!(TimezoneOffsetZ)]; TOO_LONG);
check!("+12 34 ", [fix!(TimezoneOffsetZ)]; INVALID);
check!(" +12:34", [fix!(TimezoneOffsetZ)]; offset: 45_240);
check!("+12345", [fix!(TimezoneOffsetZ), num!(Day)]; offset: 45_240, day: 5);
check!("+12:345", [fix!(TimezoneOffsetZ), num!(Day)]; offset: 45_240, day: 5);
Expand Down Expand Up @@ -1165,7 +1165,7 @@ mod tests {
check!("12345678", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+1", [internal_fix!(TimezoneOffsetPermissive)]; TOO_SHORT);
check!("+12", [internal_fix!(TimezoneOffsetPermissive)]; offset: 43_200);
check!("+123", [internal_fix!(TimezoneOffsetPermissive)]; TOO_SHORT);
check!("+123", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+1234", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("-1234", [internal_fix!(TimezoneOffsetPermissive)]; offset: -45_240);
check!("−1234", [internal_fix!(TimezoneOffsetPermissive)]; offset: -45_240); // MINUS SIGN (U+2212)
Expand All @@ -1181,8 +1181,8 @@ mod tests {
check!("12:34:5", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("12:34:56", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+1:", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+12:", [internal_fix!(TimezoneOffsetPermissive)]; offset: 43_200);
check!("+12:3", [internal_fix!(TimezoneOffsetPermissive)]; TOO_SHORT);
check!("+12:", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:3", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("-12:34", [internal_fix!(TimezoneOffsetPermissive)]; offset: -45_240);
check!("−12:34", [internal_fix!(TimezoneOffsetPermissive)]; offset: -45_240); // MINUS SIGN (U+2212)
Expand All @@ -1192,23 +1192,23 @@ mod tests {
check!("+12:34:56:", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:34:56:7", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:34:56:78", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 :34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12: 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 : 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 :34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12: 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 : 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12::34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 ::34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12: :34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12:: 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 ::34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12: :34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12:: 34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12:::34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12::::34", [internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("+12 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 :34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12: 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 : 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 :34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12: 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 : 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12::34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 ::34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12: :34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:: 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12 ::34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12: :34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:: 34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:::34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12::::34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("12:34 ", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!(" 12:34", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+12:34 ", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
Expand All @@ -1220,7 +1220,7 @@ mod tests {
check!("+12:34:", [internal_fix!(TimezoneOffsetPermissive), lit!(":")]; offset: 45_240);
check!("🤠+12:34", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+12:34🤠", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:🤠34", [internal_fix!(TimezoneOffsetPermissive)]; INVALID);
check!("+12:🤠34", [internal_fix!(TimezoneOffsetPermissive)]; TOO_LONG);
check!("+12:34🤠", [internal_fix!(TimezoneOffsetPermissive), lit!("🤠")]; offset: 45_240);
check!("🤠+12:34", [lit!("🤠"), internal_fix!(TimezoneOffsetPermissive)]; offset: 45_240);
check!("Z", [internal_fix!(TimezoneOffsetPermissive)]; offset: 0);
Expand Down Expand Up @@ -1362,7 +1362,7 @@ mod tests {
("Tue, 20 Jan 2015 17:35:20Z", Err(INVALID)), // bad offset: zulu not allowed
("Tue, 20 Jan 2015 17:35:20 Zulu", Err(NOT_ENOUGH)), // bad offset: zulu not allowed
("Tue, 20 Jan 2015 17:35:20 ZULU", Err(NOT_ENOUGH)), // bad offset: zulu not allowed
("Tue, 20 Jan 2015 17:35:20 −0800", Err(INVALID)), // bad offset: timezone offset using MINUS SIGN (U+2212), not specified for RFC 2822
("Tue, 20 Jan 2015 17:35:20 −0800", Ok("Tue, 20 Jan 2015 17:35:20 -0800")), // timezone offset using MINUS SIGN (U+2212)
("Tue, 20 Jan 2015 17:35:20 0800", Err(INVALID)), // missing offset sign
("Tue, 20 Jan 2015 17:35:20 HAS", Err(NOT_ENOUGH)), // bad named timezone
("Tue, 20 Jan 2015😈17:35:20 -0800", Err(INVALID)), // bad character!
Expand Down

0 comments on commit 438d354

Please sign in to comment.