ruby/test/strscan/test_ractor.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 строки
650 B
Ruby
Исходник Обычный вид История

# frozen_string_literal: true
require 'test/unit'
class TestStringScannerRactor < Test::Unit::TestCase
def setup
2022-12-09 07:03:33 +03:00
omit "Ractor not defined" 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