()
| 1688 | |
| 1689 | #[test] |
| 1690 | fn string_to_timestamp_invalid() { |
| 1691 | // Test parsing invalid formats |
| 1692 | let cases = [ |
| 1693 | ("", "timestamp must contain at least 10 characters"), |
| 1694 | ("SS", "timestamp must contain at least 10 characters"), |
| 1695 | ("Wed, 18 Feb 2015 23:16:09 GMT", "error parsing date"), |
| 1696 | ("1997-01-31H09:26:56.123Z", "invalid timestamp separator"), |
| 1697 | ("1997-01-31 09:26:56.123Z", "error parsing time"), |
| 1698 | ("1997:01:31T09:26:56.123Z", "error parsing date"), |
| 1699 | ("1997:1:31T09:26:56.123Z", "error parsing date"), |
| 1700 | ("1997-01-32T09:26:56.123Z", "error parsing date"), |
| 1701 | ("1997-13-32T09:26:56.123Z", "error parsing date"), |
| 1702 | ("1997-02-29T09:26:56.123Z", "error parsing date"), |
| 1703 | ("2015-02-30T17:35:20-08:00", "error parsing date"), |
| 1704 | ("1997-01-10T9:26:56.123Z", "error parsing time"), |
| 1705 | ("2015-01-20T25:35:20-08:00", "error parsing time"), |
| 1706 | ("1997-01-10T09:61:56.123Z", "error parsing time"), |
| 1707 | ("1997-01-10T09:61:90.123Z", "error parsing time"), |
| 1708 | ("1997-01-10T12:00:6.123Z", "error parsing time"), |
| 1709 | ("1997-01-31T092656.123Z", "error parsing time"), |
| 1710 | ("1997-01-10T12:00:06.", "error parsing time"), |
| 1711 | ("1997-01-10T12:00:06. ", "error parsing time"), |
| 1712 | ]; |
| 1713 | |
| 1714 | for (s, ctx) in cases { |
| 1715 | let expected = format!("Parser error: Error parsing timestamp from '{s}': {ctx}"); |
| 1716 | let actual = string_to_datetime(&Utc, s).unwrap_err().to_string(); |
| 1717 | assert_eq!(actual, expected) |
| 1718 | } |
| 1719 | } |
| 1720 | |
| 1721 | // Parse a timestamp to timestamp int with a useful human readable error message |
| 1722 | fn parse_timestamp(s: &str) -> Result<i64, ArrowError> { |
nothing calls this directly
no test coverage detected