summaryrefslogtreecommitdiff
path: root/test/io/wait/test_ractor.rb
blob: 3d286af77f9b0a2e9ed114688f389a2ca39a8859 (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 'rbconfig'
require 'io/wait'

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

  def test_ractor
    ext = "/io/wait.#{RbConfig::CONFIG['DLEXT']}"
    path = $".find {|path| path.end_with?(ext)}
    assert_in_out_err(%W[-r#{path}], <<-"end;", ["true"], [])
      $VERBOSE = nil
      r = Ractor.new do
        $stdout.equal?($stdout.wait_writable)
      end
      puts r.take
    end;
  end
end