Skip to content

Commit a90d13c

Browse files
committed
Add a test of Ractor
1 parent cb37366 commit a90d13c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/bigdecimal/test_ractor.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
require_relative "testbase"
3+
4+
class TestBigDecimalRactor < Test::Unit::TestCase
5+
include TestBigDecimalBase
6+
7+
def setup
8+
super
9+
skip unless defined? Ractor
10+
end
11+
12+
def test_ractor_shareable
13+
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
14+
begin;
15+
$VERBOSE = nil
16+
require "bigdecimal"
17+
r = Ractor.new BigDecimal(Math::PI, Float::DIG+1) do |pi|
18+
BigDecimal('2.0')*pi
19+
end
20+
assert_equal(2*Math::PI, r.take)
21+
end;
22+
end
23+
end

0 commit comments

Comments
 (0)