mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 19:41:37 +08:00
Add tests confirming DateTime works with " " seperator instead of "T"
This commit is contained in:
parent
34d5e2db24
commit
6d9b268776
@ -129,7 +129,7 @@ impl FromSql for DateTime<Local> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use Connection;
|
use Connection;
|
||||||
use super::chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, UTC};
|
use super::chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, UTC, Duration};
|
||||||
|
|
||||||
fn checked_memory_handle() -> Connection {
|
fn checked_memory_handle() -> Connection {
|
||||||
let db = Connection::open_in_memory().unwrap();
|
let db = Connection::open_in_memory().unwrap();
|
||||||
@ -192,8 +192,15 @@ mod test {
|
|||||||
|
|
||||||
let s: String = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
let s: String = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
||||||
assert_eq!("2016-02-23T23:56:04.789+00:00", s);
|
assert_eq!("2016-02-23T23:56:04.789+00:00", s);
|
||||||
let v: DateTime<UTC> = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
|
||||||
assert_eq!(utc, v);
|
let v1: DateTime<UTC> = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
||||||
|
assert_eq!(utc, v1);
|
||||||
|
|
||||||
|
let v2: DateTime<UTC> = db.query_row("SELECT '2016-02-23 23:56:04.789'", &[], |r| r.get(0)).unwrap();
|
||||||
|
assert_eq!(utc, v2);
|
||||||
|
|
||||||
|
let v3: DateTime<UTC> = db.query_row("SELECT '2016-02-23 23:56:04'", &[], |r| r.get(0)).unwrap();
|
||||||
|
assert_eq!(utc - Duration::milliseconds(789), v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user