summaryrefslogtreecommitdiff
path: root/test/pathname/test_ractor.rb
blob: 3d7b63deed4b6a61be4c0e4807d23736a7f5b791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true
require "test/unit"
require "pathname"

class TestPathnameRactor < Test::Unit::TestCase
  def setup
    omit unless defined? Ractor
  end

  def test_ractor_shareable
    assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
    begin;
      $VERBOSE = nil
      require "pathname"
      r = Ractor.new Pathname("a") do |x|
        x.join(Pathname("b"), Pathname("c"))
      end
      assert_equal(Pathname("a/b/c"), r.take)
    end;
  end
end