Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions core/time/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,23 @@ def obj.to_int; 3; end
}.should.raise(ArgumentError, /missing min part: 00 |can't parse:/)
end

# These strings end exactly at the byte where the parser expects a ':', so
# the message has no offending byte to append. The other error cases here
# all carry a trailing zone, which left that boundary unexercised.
it "raises ArgumentError if the time string ends where a ':' is expected" do
-> {
Time.new("2020-12-25 00:56")
}.should.raise(ArgumentError, /\Amissing sec part: 00:56\z|can't parse:/)

-> {
Time.new("2020-12-25T00:56")
}.should.raise(ArgumentError, /\Amissing sec part: 00:56\z|can't parse:/)

-> {
Time.new("2020-12-25 00")
}.should.raise(ArgumentError, /\Amissing min part: 00\z|can't parse:/)
end

it "raises ArgumentError if the time part is missing" do
-> {
Time.new("2020-12-25")
Expand Down