From c84e86ecb1f28134ecb0f9ea4b69c43c98ee1ba2 Mon Sep 17 00:00:00 2001 From: dfhoughton Date: Sat, 2 Feb 2019 17:53:10 -0500 Subject: handle noon and midnight --- tests/tests.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') diff --git a/tests/tests.rs b/tests/tests.rs index 4cfe14b..51d466c 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1300,3 +1300,35 @@ fn number_before_test() { } } } + +#[test] +fn noon() { + let d1 = NaiveDate::from_ymd(1969, 5, 6).and_hms(12, 0, 0); + let d2 = d1 + Duration::hours(1); + match parse("noon on May 6, 1969", None) { + Ok((start, end, _)) => { + assert_eq!(d1, start); + assert_eq!(d2, end); + } + Err(e) => { + println!("{:?}", e); + assert!(false, "didn't match"); + } + } +} + +#[test] +fn midnight() { + let d1 = NaiveDate::from_ymd(1969, 5, 7).and_hms(0, 0, 0); + let d2 = d1 + Duration::hours(1); + match parse("midnight on May 6, 1969", None) { + Ok((start, end, _)) => { + assert_eq!(d1, start); + assert_eq!(d2, end); + } + Err(e) => { + println!("{:?}", e); + assert!(false, "didn't match"); + } + } +} \ No newline at end of file -- cgit v1.2.3