Add extra tests for nanosecond and millisecond parsing

This commit is contained in:
Tobie Morgan Hitchcock 2023-03-05 21:59:42 +00:00
parent 7dcb0f83fa
commit fa0ec302ca

View file

@ -307,6 +307,24 @@ mod tests {
assert_eq!("'2012-04-24T02:55:43.511Z'", format!("{}", out)); assert_eq!("'2012-04-24T02:55:43.511Z'", format!("{}", out));
} }
#[test]
fn date_time_timezone_utc_nanoseconds() {
let sql = "2012-04-23T18:25:43.5110000Z";
let res = datetime_raw(sql);
assert!(res.is_ok());
let out = res.unwrap().1;
assert_eq!("'2012-04-23T18:25:43.511Z'", format!("{}", out));
}
#[test]
fn date_time_timezone_utc_sub_nanoseconds() {
let sql = "2012-04-23T18:25:43.0000511Z";
let res = datetime_raw(sql);
assert!(res.is_ok());
let out = res.unwrap().1;
assert_eq!("'2012-04-23T18:25:43.000051100Z'", format!("{}", out));
}
#[test] #[test]
fn date_time_illegal_date() { fn date_time_illegal_date() {
// Hey! There's not a 31st of November! // Hey! There's not a 31st of November!