[ruby/date] Skip tests failing on TruffleRuby

https://github.com/ruby/date/commit/d019ac8186
This commit is contained in:
Andrew Konchin 2024-11-15 12:49:53 +02:00 committed by git
parent cfee3d9f4b
commit 8adc96b5ca
2 changed files with 15 additions and 9 deletions

View File

@ -89,11 +89,14 @@ class TestDateConv < Test::Unit::TestCase
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec]) [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec])
end end
if Time.allocate.respond_to?(:subsec) # TruffleRuby does not support more than nanoseconds
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000 unless RUBY_ENGINE == 'truffleruby'
t = d.to_time.utc if Time.allocate.respond_to?(:subsec)
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)], d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec]) t = d.to_time.utc
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)],
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec])
end
end end
end end

View File

@ -589,10 +589,13 @@ class TestDateParse < Test::Unit::TestCase
end end
def test__parse_too_long_year def test__parse_too_long_year
str = "Jan 1" + "0" * 100_000 # Math.log10 does not support so big numbers like 10^100_000 on TruffleRuby
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)} unless RUBY_ENGINE == 'truffleruby'
assert_equal(100_000, Math.log10(h[:year])) str = "Jan 1" + "0" * 100_000
assert_equal(1, h[:mon]) h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}
assert_equal(100_000, Math.log10(h[:year]))
assert_equal(1, h[:mon])
end
str = "Jan - 1" + "0" * 100_000 str = "Jan - 1" + "0" * 100_000
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)} h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}