summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordfhoughton <dfhoughton@gmail.com>2018-12-29 14:47:25 -0500
committerdfhoughton <dfhoughton@gmail.com>2018-12-29 14:47:25 -0500
commita337fc255e600cc60805cbfeb4d623243fd0430b (patch)
tree179e82dc66ac590d0224fe3ab6d88807d412fc41 /tests
parent3f677ffec9d205cb2340ca5b4f27ed841372f288 (diff)
downloadtwo-timer-a337fc255e600cc60805cbfeb4d623243fd0430b.zip
handle years better
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs112
1 files changed, 65 insertions, 47 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 9280c82..4a0aa82 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -27,7 +27,7 @@ fn always() {
#[test]
fn yesterday() {
let now = Utc::now();
- let (start, end) = parse("yesterday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("yesterday", Some(Config::new().now(now))).unwrap();
assert!(start < now);
assert!(end < now);
let then = now - Duration::days(1);
@@ -40,7 +40,7 @@ fn yesterday() {
#[test]
fn tomorrow() {
let now = Utc::now();
- let (start, end) = parse("tomorrow", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("tomorrow", Some(Config::new().now(now))).unwrap();
assert!(start > now);
assert!(end > now);
let then = now + Duration::days(1);
@@ -53,7 +53,7 @@ fn tomorrow() {
#[test]
fn today() {
let now = Utc::now();
- let (start, end) = parse("today", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("today", Some(Config::new().now(now))).unwrap();
assert!(start < now);
assert!(end > now);
let then = now + Duration::days(1);
@@ -154,7 +154,7 @@ fn at_3_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3 PM", "3 pm", "15"].iter() {
- let (start, end) = parse(phrase, Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
}
@@ -165,7 +165,7 @@ fn at_3_00_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3:00 PM", "3:00 pm", "15:00"].iter() {
- let (start, end) = parse(phrase, Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::minutes(1), end);
}
@@ -176,7 +176,7 @@ fn at_3_00_00_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(16, 0, 0);
let then = Utc.ymd(1969, 5, 6).and_hms(15, 0, 0);
for phrase in ["3:00:00 PM", "3:00:00 pm", "15:00:00"].iter() {
- let (start, end) = parse(phrase, Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::seconds(1), end);
}
@@ -187,7 +187,7 @@ fn at_3_pm_yesterday() {
let now = Utc.ymd(1969, 5, 6).and_hms(14, 0, 0);
let then = Utc.ymd(1969, 5, 5).and_hms(15, 0, 0);
for phrase in ["3 PM yesterday", "3 pm yesterday", "15 yesterday"].iter() {
- let (start, end) = parse(phrase, Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse(phrase, Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
}
@@ -345,7 +345,7 @@ fn this_month() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
- let (start, end) = parse("this month", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -355,7 +355,7 @@ fn next_month() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 7, 1).and_hms(0, 0, 0);
- let (start, end) = parse("next month", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -365,7 +365,7 @@ fn last_month() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let (start, end) = parse("last month", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last month", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -375,7 +375,7 @@ fn this_year() {
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(1970, 1, 1).and_hms(0, 0, 0);
- let (start, end) = parse("this year", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -385,7 +385,7 @@ fn next_year() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1970, 1, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1971, 1, 1).and_hms(0, 0, 0);
- let (start, end) = parse("next year", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -395,7 +395,7 @@ fn last_year() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1968, 1, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 1, 1).and_hms(0, 0, 0);
- let (start, end) = parse("last year", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last year", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -405,7 +405,7 @@ fn this_week() {
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, 12).and_hms(0, 0, 0);
- let (start, end) = parse("this week", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -415,7 +415,7 @@ fn next_week() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 12).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 19).and_hms(0, 0, 0);
- let (start, end) = parse("next week", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -425,7 +425,7 @@ fn last_week() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 4, 28).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
- let (start, end) = parse("last week", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last week", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -437,7 +437,7 @@ fn this_week_sunday_starts() {
let d2 = Utc.ymd(1969, 5, 11).and_hms(0, 0, 0);
let (start, end) = parse(
"this week",
- Some(Config::default().now(now).monday_starts_week(false)),
+ Some(Config::new().now(now).monday_starts_week(false)),
)
.unwrap();
assert_eq!(d1, start);
@@ -451,7 +451,7 @@ fn next_week_sunday_starts() {
let d2 = Utc.ymd(1969, 5, 18).and_hms(0, 0, 0);
let (start, end) = parse(
"next week",
- Some(Config::default().now(now).monday_starts_week(false)),
+ Some(Config::new().now(now).monday_starts_week(false)),
)
.unwrap();
assert_eq!(d1, start);
@@ -465,7 +465,7 @@ fn last_week_sunday_starts() {
let d2 = Utc.ymd(1969, 5, 4).and_hms(0, 0, 0);
let (start, end) = parse(
"last week",
- Some(Config::default().now(now).monday_starts_week(false)),
+ Some(Config::new().now(now).monday_starts_week(false)),
)
.unwrap();
assert_eq!(d1, start);
@@ -476,7 +476,7 @@ fn last_week_sunday_starts() {
fn this_pay_period() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
@@ -491,7 +491,7 @@ fn this_pay_period() {
fn next_pay_period() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
@@ -506,7 +506,7 @@ fn next_pay_period() {
fn last_pay_period() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year before "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1968, 5, 5)))
.pay_period_length(14)
.now(now);
@@ -521,7 +521,7 @@ fn last_pay_period() {
fn this_pay_period_weird() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
@@ -536,7 +536,7 @@ fn this_pay_period_weird() {
fn next_pay_period_weird() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
@@ -551,7 +551,7 @@ fn next_pay_period_weird() {
fn last_pay_period_weird() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
// two-week pay period beginning about a year *after* "now" on a Sunday
- let config = Config::default()
+ let config = Config::new()
.pay_period_start(Some(Utc.ymd(1970, 4, 5)))
.pay_period_length(14)
.now(now);
@@ -567,7 +567,7 @@ fn this_april() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let (start, end) = parse("this april", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -577,7 +577,7 @@ fn next_april() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1970, 4, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1970, 5, 1).and_hms(0, 0, 0);
- let (start, end) = parse("next april", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -587,7 +587,7 @@ fn last_april() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1968, 4, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1968, 5, 1).and_hms(0, 0, 0);
- let (start, end) = parse("last april", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last april", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -597,7 +597,7 @@ fn this_friday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 9).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 10).and_hms(0, 0, 0);
- let (start, end) = parse("this friday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -607,7 +607,7 @@ fn next_friday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 16).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 17).and_hms(0, 0, 0);
- let (start, end) = parse("next friday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -617,7 +617,7 @@ fn last_friday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 2).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 3).and_hms(0, 0, 0);
- let (start, end) = parse("last friday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -627,7 +627,7 @@ fn this_monday() {
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, 6).and_hms(0, 0, 0);
- let (start, end) = parse("this monday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("this monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -637,7 +637,7 @@ fn next_monday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 12).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 13).and_hms(0, 0, 0);
- let (start, end) = parse("next monday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("next monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -647,7 +647,7 @@ fn last_monday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 4, 28).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
- let (start, end) = parse("last monday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("last monday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -708,7 +708,7 @@ fn the_crack_of_doom() {
fn friday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 5, 2).and_hms(0, 0, 0);
- let (start, end) = parse("Friday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
}
@@ -717,7 +717,7 @@ fn friday() {
fn tuesday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 4, 29).and_hms(0, 0, 0);
- let (start, end) = parse("Tuesday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Tuesday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
}
@@ -726,7 +726,7 @@ fn tuesday() {
fn monday() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 5, 5).and_hms(0, 0, 0);
- let (start, end) = parse("Monday", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Monday", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::days(1), end);
}
@@ -735,7 +735,7 @@ fn monday() {
fn friday_at_3_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 5, 2).and_hms(15, 0, 0);
- let (start, end) = parse("Friday at 3 pm", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Friday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
}
@@ -744,7 +744,7 @@ fn friday_at_3_pm() {
fn tuesday_at_3_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 4, 29).and_hms(15, 0, 0);
- let (start, end) = parse("Tuesday at 3 pm", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Tuesday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
}
@@ -753,7 +753,7 @@ fn tuesday_at_3_pm() {
fn monday_at_3_pm() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let then = Utc.ymd(1969, 5, 5).and_hms(15, 0, 0);
- let (start, end) = parse("Monday at 3 pm", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("Monday at 3 pm", Some(Config::new().now(now))).unwrap();
assert_eq!(then, start);
assert_eq!(then + Duration::hours(1), end);
}
@@ -763,7 +763,7 @@ fn just_may() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 6, 1).and_hms(0, 0, 0);
- let (start, end) = parse("May", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("May", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -773,7 +773,7 @@ fn just_april() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1969, 4, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1969, 5, 1).and_hms(0, 0, 0);
- let (start, end) = parse("April", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("April", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -783,7 +783,7 @@ fn just_june() {
let now = Utc.ymd(1969, 5, 6).and_hms(0, 0, 0);
let d1 = Utc.ymd(1968, 6, 1).and_hms(0, 0, 0);
let d2 = Utc.ymd(1968, 7, 1).and_hms(0, 0, 0);
- let (start, end) = parse("June", Some(Config::default().now(now))).unwrap();
+ let (start, end) = parse("June", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -793,7 +793,7 @@ 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();
+ let (start, end) = parse("Monday through Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -803,7 +803,7 @@ 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();
+ let (start, end) = parse("Tuesday through Friday", Some(Config::new().now(now))).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}
@@ -815,7 +815,7 @@ fn tuesday_through_3_pm_on_friday() {
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)),
+ Some(Config::new().now(now)),
)
.unwrap();
assert_eq!(d1, start);
@@ -827,7 +827,25 @@ 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();
+ let (start, end) = parse("this year through today", Some(Config::new().now(now))).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn april_3_25_bc() {
+ let d1 = Utc.ymd(-24, 4, 3).and_hms(0, 0, 0);
+ let d2 = d1 + Duration::days(1);
+ let (start, end) = parse("April 3, 25 BC", None).unwrap();
+ assert_eq!(d1, start);
+ assert_eq!(d2, end);
+}
+
+#[test]
+fn april_3_25_ad() {
+ let d1 = Utc.ymd(25, 4, 3).and_hms(0, 0, 0);
+ let d2 = d1 + Duration::days(1);
+ let (start, end) = parse("April 3, 25 AD", None).unwrap();
assert_eq!(d1, start);
assert_eq!(d2, end);
}