diff options
author | dfhoughton <dfhoughton@gmail.com> | 2018-12-28 17:39:39 -0500 |
---|---|---|
committer | dfhoughton <dfhoughton@gmail.com> | 2018-12-28 17:39:39 -0500 |
commit | 3f677ffec9d205cb2340ca5b4f27ed841372f288 (patch) | |
tree | c7e554e4d12d74d6852b22613d84933b1ae1049d /tests/tests.rs | |
parent | 3201de663d1922846181cb252732c2de81aee393 (diff) | |
download | two-timer-3f677ffec9d205cb2340ca5b4f27ed841372f288.zip |
more two-time expressions working
Diffstat (limited to 'tests/tests.rs')
-rw-r--r-- | tests/tests.rs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/tests/tests.rs b/tests/tests.rs index 014ddcb..9280c82 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -786,4 +786,48 @@ fn just_june() { let (start, end) = parse("June", Some(Config::default().now(now))).unwrap(); assert_eq!(d1, start); assert_eq!(d2, end); -}
\ No newline at end of file +} + +#[test] +fn monday_through_friday() { + let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0); + let d1 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0); + let d2 = Utc.ymd(1969, 5, 10).and_hms(0, 0, 0); + let (start, end) = parse("Monday through Friday", Some(Config::default().now(now))).unwrap(); + assert_eq!(d1, start); + assert_eq!(d2, end); +} + +#[test] +fn tuesday_through_friday() { + let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0); + let d1 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0); + let d2 = Utc.ymd(1969, 5, 3).and_hms(0, 0, 0); + let (start, end) = parse("Tuesday through Friday", Some(Config::default().now(now))).unwrap(); + assert_eq!(d1, start); + assert_eq!(d2, end); +} + +#[test] +fn tuesday_through_3_pm_on_friday() { + let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0); + let d1 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0); + let d2 = Utc.ymd(1969, 5, 2).and_hms(15, 0, 0); + let (start, end) = parse( + "Tuesday through 3 PM on Friday", + Some(Config::default().now(now)), + ) + .unwrap(); + assert_eq!(d1, start); + assert_eq!(d2, end); +} + +#[test] +fn this_year_through_today() { + let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0); + let d1 = Utc.ymd(1969, 1, 1).and_hms(0, 0, 0); + let d2 = Utc.ymd(1969, 5, 7).and_hms(0, 0, 0); + let (start, end) = parse("this year through today", Some(Config::default().now(now))).unwrap(); + assert_eq!(d1, start); + assert_eq!(d2, end); +} |