Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 25, 2022
1 parent 2f7814c commit 5a138af
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/date/test_date_parse.rb
Expand Up @@ -587,12 +587,12 @@ def test__parse_odd_offset

def test__parse_too_long_year
str = "Jan 1" + "0" * 100_000
h = Timeout.timeout(1) {Date._parse(str)}
h = Timeout.timeout(1) {Date._parse(str, limit: 100_010)}
assert_equal(100_000, Math.log10(h[:year]))
assert_equal(1, h[:mon])

str = "Jan - 1" + "0" * 100_000
h = Timeout.timeout(1) {Date._parse(str)}
h = Timeout.timeout(1) {Date._parse(str, limit: 100_010)}
assert_equal(1, h[:mon])
assert_not_include(h, :year)
end
Expand Down Expand Up @@ -1309,6 +1309,5 @@ def test_length_limit
assert_raise(ArgumentError) { DateTime.jisx0301("1" * 1000) }

assert_raise(ArgumentError) { Date._parse("Jan " + "9" * 1000000) }
assert_raise(Timeout::Error) { Timeout.timeout(1) { Date._parse("Jan " + "9" * 1000000, limit: nil) } }
end
end

0 comments on commit 5a138af

Please sign in to comment.