summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-10-09 13:31:57 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-10-09 17:03:39 +0200
commit0c33cb7ac61ba3764d80a0b7f5be356dcc2e1630 (patch)
treebf178fe6dfd6a25013815c13e43aab32a2aba6de
parentcec6d90bd536a804ba669f2237aa16857e8e407a (diff)
Add another testcase for adding months over year-borders
-rw-r--r--src/timetype.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs
index 7832d85..c7fa0d5 100644
--- a/src/timetype.rs
+++ b/src/timetype.rs
@@ -2278,6 +2278,20 @@ mod moment_plus_amount_tests {
amount = TT::months(4);
expected = NaiveDate::from_ymd(2001, 3, 1).and_hms(0, 0, 0);
}
+
+ generate_test_moment_plus_amount! {
+ name = test_moment_plus_more_than_one_year_in_months_5;
+ base = NaiveDate::from_ymd(2000,10,31).and_hms(0, 0, 0);
+ amount = TT::months(5);
+ expected = NaiveDate::from_ymd(2001, 4, 1).and_hms(0, 0, 0);
+ }
+
+ generate_test_moment_plus_amount! {
+ name = test_moment_plus_more_than_one_year_in_months_6;
+ base = NaiveDate::from_ymd(2000,10,31).and_hms(0, 0, 0);
+ amount = TT::months(4) + TT::months(1);
+ expected = NaiveDate::from_ymd(2001, 4, 1).and_hms(0, 0, 0);
+ }
}
#[cfg(test)]