Raise error on negative usec param to Time.new.#5371
Merged
headius merged 2 commits intojruby:masterfrom Oct 15, 2018
Merged
Conversation
til
reviewed
Oct 15, 2018
til
left a comment
There was a problem hiding this comment.
Thanks for the quick fix.
Maybe also add a spec to protect against a regression of this specific bug? (No idea how likely that is though).
# [Bug #5370]
it "raises ArgumentError if the seconds argument is negative fraction of second" do
lambda { Time.new(2000, 1, 1, 0, 0, -0.1) }.should raise_error(ArgumentError)
end
spec/ruby/core/time/new_spec.rb
Outdated
| lambda { Time.new(2000, 1, 1, 0, 0, -1) }.should raise_error(ArgumentError) | ||
| end | ||
|
|
||
| it "raises ArgumentError if the utf_offset argument is greater than or equal to 10e9" do |
Member
Author
|
@til I think the -1 spec is just as good as the -0.1 spec, since it's just a simple test for negative seconds. The fact that it's a fractional amount does not appear to change the logic. |
aa8dd44 to
2375ff7
Compare
Member
Author
|
Force pushed with corrected utf/utc line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5370.
I'll add specs momentarily.