Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TruffleRuby in CI #115

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby
engine: cruby-truffleruby
min_version: 2.6

build:
Expand All @@ -24,6 +24,14 @@ jobs:
exclude:
- ruby: head
os: windows-latest
- ruby: truffleruby # need truffleruby 24.2+
os: ubuntu-latest
- ruby: truffleruby # need truffleruby 24.2+
os: macos-latest
- ruby: truffleruby
os: windows-latest
- ruby: truffleruby-head
os: windows-latest
include:
- ruby: mingw
os: windows-latest
Expand Down
13 changes: 8 additions & 5 deletions test/date/test_date_conv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ def test_to_time__from_datetime
[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

Expand Down
11 changes: 7 additions & 4 deletions test/date/test_date_parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,13 @@ def test__parse_odd_offset
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)}
Expand Down
Loading