diff options
author | dfhoughton <dfhoughton@gmail.com> | 2019-02-02 17:53:10 -0500 |
---|---|---|
committer | dfhoughton <dfhoughton@gmail.com> | 2019-02-02 17:53:10 -0500 |
commit | c84e86ecb1f28134ecb0f9ea4b69c43c98ee1ba2 (patch) | |
tree | 21467ba99cac52c6d6849b6805e79c84cdb661b9 /tests/tests.rs | |
parent | 42bd15810e323a96fdd684da26bd890de68d5b9c (diff) | |
download | two-timer-c84e86ecb1f28134ecb0f9ea4b69c43c98ee1ba2.zip |
handle noon and midnight
Diffstat (limited to 'tests/tests.rs')
-rw-r--r-- | tests/tests.rs | 32 |
1 files changed, 32 insertions, 0 deletions
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 |