summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Konchin <andry.konchin@gmail.com>2024-11-15 12:49:53 +0200
committergit <svn-admin@ruby-lang.org>2025-01-10 15:59:25 +0000
commit8adc96b5ca17c504d7a4afe7c6034c1d4d1984ba (patch)
treebd4a1c7d52d64499ce67354fee40ff297325a85e
parentcfee3d9f4bc62c7a312be1a31c61f5126fec157f (diff)
[ruby/date] Skip tests failing on TruffleRuby
https://github.com/ruby/date/commit/d019ac8186
-rw-r--r--test/date/test_date_conv.rb13
-rw-r--r--test/date/test_date_parse.rb11
2 files changed, 15 insertions, 9 deletions
diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb
index ed478b41bb..772fbee9a4 100644
--- a/test/date/test_date_conv.rb
+++ b/test/date/test_date_conv.rb
@@ -89,11 +89,14 @@ class TestDateConv < Test::Unit::TestCase
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec])
end
- if Time.allocate.respond_to?(:subsec)
- d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
- 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])
+ # TruffleRuby does not support more than nanoseconds
+ unless RUBY_ENGINE == 'truffleruby'
+ if Time.allocate.respond_to?(:subsec)
+ d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
+ 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
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index 16362e3bff..cc29771cf8 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -589,10 +589,13 @@ class TestDateParse < Test::Unit::TestCase
end
def test__parse_too_long_year
- str = "Jan 1" + "0" * 100_000
- h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}
- assert_equal(100_000, Math.log10(h[:year]))
- assert_equal(1, h[:mon])
+ # Math.log10 does not support so big numbers like 10^100_000 on TruffleRuby
+ unless RUBY_ENGINE == 'truffleruby'
+ str = "Jan 1" + "0" * 100_000
+ 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
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}