-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test coverage for pre-1970 dates #215
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #215 +/- ##
==========================================
+ Coverage 50.60% 53.00% +2.40%
==========================================
Files 17 17
Lines 1984 2079 +95
==========================================
+ Hits 1004 1102 +98
+ Misses 980 977 -3
Continue to review full report at Codecov.
|
assert_eq!( | ||
Err(Error::BadDerTime), | ||
time_from_ymdhms_utc(UNIX_EPOCH_YEAR - 1, 1, 1, 0, 0, 0) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems OK to me, but I'd also like to see test cases for the very edge cases: the moment before the first of 1970 and exactly 1970.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the tests to cover:
- 1969-12-31 00:00:00
- 1969-12-31 23:59:59
- 1970-01-01 00:00:00
- 1970-01-01 00:00:01
- 1971-01-01 00:00:00
This would catch off by one errors in date calculations.
This patch adds some extra tests for
calendar.rs
for the code paths that check for pre-1970 dates. I noticed that the tests only looked at the happy path so I added some that make sure an Err is returned when expected.