* 2022-01-18 [ci skip]
[ruby-80x24.org.git] / test / stringio / test_ractor.rb
blob1c334e2c3f9ae85d6476a160678f2acc86832646
1 # frozen_string_literal: true
2 require 'test/unit'
4 class TestStringIOInRactor < Test::Unit::TestCase
5   def setup
6     omit unless defined? Ractor
7   end
9   def test_ractor
10     assert_in_out_err([], <<-"end;", ["true"], [])
11       require "stringio"
12       $VERBOSE = nil
13       r = Ractor.new do
14         io = StringIO.new("")
15         io.puts "abc"
16         io.truncate(0)
17         io.puts "def"
18         "\0\0\0\0def\n" == io.string
19       end
20       puts r.take
21     end;
22   end
23 end