1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/strscan/test_ractor.rb
Kenta Murata 985f0af257
[strscan] Make strscan Ractor safe (#17)
* Make strscan Ractor safe

* Add test-unit in the development dependencies

https://github.com/ruby/strscan/commit/3c93c2bebe
2020-12-18 14:25:41 +09:00

28 lines
629 B
Ruby

# frozen_string_literal: true
require 'test/unit'
class TestStringScannerRactor < Test::Unit::TestCase
def setup
skip unless defined? Ractor
end
def test_ractor
assert_in_out_err([], <<-"end;", ["stra", " ", "strb", " ", "strc"], [])
require "strscan"
$VERBOSE = nil
r = Ractor.new do
s = StringScanner.new("stra strb strc", true)
[
s.scan(/\\w+/),
s.scan(/\\s+/),
s.scan(/\\w+/),
s.scan(/\\s+/),
s.scan(/\\w+/),
s.scan(/\\w+/),
s.scan(/\\w+/)
]
end
puts r.take.compact
end;
end
end