Skip to content
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

Merge 0.4.x #1401

Merged
merged 25 commits into from
Feb 2, 2024
Merged

Merge 0.4.x #1401

merged 25 commits into from
Feb 2, 2024

Conversation

pitdicker
Copy link
Collaborator

This will bring the first two commits of #1394 (merged in #1395) to the 0.5.x branch.

djc and others added 25 commits January 26, 2024 14:53
  - Added tests for creating the maximum and minimum allowable values of
    Durations having a magnitude of seconds, testing the limits plus one
    value beyond the limits in both directions. These tests all pass.

  - Expanded the tests for creating the maximum and minimum allowable
    values of Durations having a magnitude of milliseconds. These tests
    examine the results in more detail, document what is being tested,
    and also test one value beyond the limits in both directions.
    Notably, the test for Duration::milliseconds() construction for
    i64::MIN currently fails, as it is erroneously allowed. This test is
    ignored for now, until the fix is applied.

  - Expanded the tests for creating the maximum and minimum allowable
    values of Durations having a magnitude of microseconds and
    nanoseconds. These tests examine the results in more detail,
    document what is being tested, and also test one value beyond the
    limits in both directions. They also test the maximum reportable
    value from .num_*() and the maximum storable value of the Duration
    separately.

  - Separated out the tests for MAX and MIN, for clarity.

  - Added additional tests for addition and subtraction operations on
    Durations, ensuring that equivalent tests are performed against both
    operations, such as adding and subtracting zero, adding and
    subtracting one nanosecond, and others.

  - Added tests for greater-than and less-than comparison of two
    Durations, to ensure that internal representation of partial seconds
    is correctly ordered.
  - Added Panics and Errors sections where appropriate, as these are
    generally-expected and help draw attention to the fact that the
    standard (i.e. non-try) constructors can panic. The Errors section
    for the try constructors is common practice when returning None for
    overflow situations as well as for functions actually returning a
    Result.

  - Added an further explanation of the behaviour of the seconds()
    constructor.

  - Minor additional readability edits.
  - Added a new Duration::try_milliseconds() function, to attempt to
    create a new milliseconds-based Duration, and return None if it
    fails, based on checking against MAX and MIN. Currently, failure can
    only happen for exactly one value, which is i64::MIN.

  - Updated Duration::milliseconds() to call try_milliseconds() and
    panic if None is returned. Although panicking in production code and
    especially library code is bad, this is in keeping with current
    Chrono behaviour. Note that this function is now no longer const.

  - Updated the Duration::milliseconds() documentation to make it clear
    that it now panics.

  - Added documentation to Duration::microseconds() and nanoseconds() to
    make it clear that they are infallible.

  - All tests now pass, including the one previously ignored.
  - Added a description of internal storage and permissable range to the
    Duration type.

  - Adjusted formatting of `Duration` in a number of related function
    Rustdoc blocks, to aid readability.

  - Clarified comments for Duration::num_milliseconds().
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (58f1f37) 93.41% compared to head (6e8c150) 93.51%.

Files Patch % Lines
src/naive/datetime/mod.rs 66.66% 6 Missing ⚠️
src/month.rs 0.00% 2 Missing ⚠️
src/offset/utc.rs 0.00% 1 Missing ⚠️
src/time_delta.rs 99.70% 1 Missing ⚠️
src/weekday.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            0.5.x    #1401      +/-   ##
==========================================
+ Coverage   93.41%   93.51%   +0.09%     
==========================================
  Files          34       34              
  Lines       16754    17018     +264     
==========================================
+ Hits        15651    15914     +263     
- Misses       1103     1104       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pitdicker pitdicker merged commit 7aa32f2 into chronotope:0.5.x Feb 2, 2024
37 checks passed
@pitdicker pitdicker deleted the merge_0.4.x branch February 2, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants