rust-postgres/tests/types/time.rs
Steven Fackler 1cee01762a Remove Range support
It now lives in a separate project
2014-12-26 17:01:02 -05:00

23 lines
749 B
Rust

extern crate time;
use self::time::Timespec;
use types::test_type;
#[test]
fn test_tm_params() {
fn make_check<'a>(time: &'a str) -> (Option<Timespec>, &'a str) {
(Some(time::strptime(time, "'%Y-%m-%d %H:%M:%S.%f'").unwrap().to_timespec()), time)
}
test_type("TIMESTAMP",
&[make_check("'1970-01-01 00:00:00.01'"),
make_check("'1965-09-25 11:19:33.100314'"),
make_check("'2010-02-09 23:11:45.1202'"),
(None, "NULL")]);
test_type("TIMESTAMP WITH TIME ZONE",
&[make_check("'1970-01-01 00:00:00.01'"),
make_check("'1965-09-25 11:19:33.100314'"),
make_check("'2010-02-09 23:11:45.1202'"),
(None, "NULL")]);
}