Skip to content

Commit d5716cc

Browse files
authored
Merge pull request #115 from andrykonchin/ak/add-truffleruby-on-ci
Add TruffleRuby in CI
2 parents 7c4876d + f6578ba commit d5716cc

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
ruby-versions:
1111
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
1212
with:
13-
engine: cruby
13+
engine: cruby-truffleruby
1414
min_version: 2.6
1515

1616
build:
@@ -24,6 +24,14 @@ jobs:
2424
exclude:
2525
- ruby: head
2626
os: windows-latest
27+
- ruby: truffleruby # need truffleruby 24.2+
28+
os: ubuntu-latest
29+
- ruby: truffleruby # need truffleruby 24.2+
30+
os: macos-latest
31+
- ruby: truffleruby
32+
os: windows-latest
33+
- ruby: truffleruby-head
34+
os: windows-latest
2735
include:
2836
- ruby: mingw
2937
os: windows-latest

test/date/test_date_conv.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ def test_to_time__from_datetime
8989
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec])
9090
end
9191

92-
if Time.allocate.respond_to?(:subsec)
93-
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
94-
t = d.to_time.utc
95-
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)],
96-
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec])
92+
# TruffleRuby does not support more than nanoseconds
93+
unless RUBY_ENGINE == 'truffleruby'
94+
if Time.allocate.respond_to?(:subsec)
95+
d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000
96+
t = d.to_time.utc
97+
assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)],
98+
[t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec])
99+
end
97100
end
98101
end
99102

test/date/test_date_parse.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,13 @@ def test__parse_odd_offset
589589
end
590590

591591
def test__parse_too_long_year
592-
str = "Jan 1" + "0" * 100_000
593-
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}
594-
assert_equal(100_000, Math.log10(h[:year]))
595-
assert_equal(1, h[:mon])
592+
# Math.log10 does not support so big numbers like 10^100_000 on TruffleRuby
593+
unless RUBY_ENGINE == 'truffleruby'
594+
str = "Jan 1" + "0" * 100_000
595+
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}
596+
assert_equal(100_000, Math.log10(h[:year]))
597+
assert_equal(1, h[:mon])
598+
end
596599

597600
str = "Jan - 1" + "0" * 100_000
598601
h = EnvUtil.timeout(3) {Date._parse(str, limit: 100_010)}

0 commit comments

Comments
 (0)