summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordfhoughton <dfhoughton@gmail.com>2019-02-03 14:10:16 -0500
committerdfhoughton <dfhoughton@gmail.com>2019-02-03 14:10:16 -0500
commit0da507aa04c73c9a1f96107f4082232cd72ade83 (patch)
tree9a8c6e476a112e7e763d3a5a4e9ab53406ce19de /tests
parent822e3ddfc9f99cb84355971f3158985d2ecce44d (diff)
downloadtwo-timer-0da507aa04c73c9a1f96107f4082232cd72ade83.zip
added before and after pattern
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 67d9fe5..9278522 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -1260,6 +1260,26 @@ fn one_week_after_may_6_1969() {
}
#[test]
+fn one_week_before_and_after_may_6_1969() {
+ let d = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0);
+ let d1 = d - Duration::days(7);
+ let d2 = d + Duration::days(7);
+ let patterns = ["one week before and after May 6, 1969", "1 week before and after May 6, 1969"];
+ for p in patterns.iter() {
+ match parse(p, None) {
+ Ok((start, end, _)) => {
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+ }
+ Err(e) => {
+ println!("{:?}", e);
+ assert!(false, "didn't match");
+ }
+ }
+ }
+}
+
+#[test]
fn one_week_around_may_6_1969() {
let d1 = NaiveDate::from_ymd(1969, 5, 6).and_hms(0, 0, 0)
- Duration::milliseconds(7 * 24 * 60 * 60 * 1000 / 2);