mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
Fix tests for MySQL chrono
This commit is contained in:
parent
d6ce866c4b
commit
038a6f2d30
@ -260,15 +260,15 @@ fn test_encode_date_time() {
|
||||
fn test_decode_date_time() {
|
||||
// test values from https://dev.mysql.com/doc/internals/en/binary-protocol-value.html
|
||||
let buf = [11, 218, 7, 10, 17, 19, 27, 30, 1, 0, 0, 0];
|
||||
let date1 = <NaiveDateTime as Decode<MySql>>::decode(&buf).unwrap();
|
||||
let date1 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
|
||||
assert_eq!(date1.to_string(), "2010-10-17 19:27:30.000001");
|
||||
|
||||
let buf = [7, 218, 7, 10, 17, 19, 27, 30];
|
||||
let date2 = <NaiveDateTime as Decode<MySql>>::decode(&buf).unwrap();
|
||||
let date2 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
|
||||
assert_eq!(date2.to_string(), "2010-10-17 19:27:30");
|
||||
|
||||
let buf = [4, 218, 7, 10, 17];
|
||||
let date3 = <NaiveDateTime as Decode<MySql>>::decode(&buf).unwrap();
|
||||
let date3 = <NaiveDateTime as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
|
||||
assert_eq!(date3.to_string(), "2010-10-17 00:00:00");
|
||||
}
|
||||
|
||||
@ -283,6 +283,6 @@ fn test_encode_date() {
|
||||
#[test]
|
||||
fn test_decode_date() {
|
||||
let buf = [4, 218, 7, 10, 17];
|
||||
let date = <NaiveDate as Decode<MySql>>::decode(&buf).unwrap();
|
||||
let date = <NaiveDate as Decode<MySql>>::decode(Some(MySqlValue::Binary(&buf))).unwrap();
|
||||
assert_eq!(date.to_string(), "2010-10-17");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user