repo.or.cz
/
ruby-80x24.org.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* 2022-01-18 [ci skip]
[ruby-80x24.org.git]
/
test
/
strscan
/
test_ractor.rb
blob
480c1ae8a6df19d7e7f7a8bb9b1a87eb945875ce
1
# frozen_string_literal: true
2
require 'test/unit'
3
4
class TestStringScannerRactor < Test::Unit::TestCase
5
def setup
6
pend unless defined? Ractor
7
end
8
9
def test_ractor
10
assert_in_out_err([], <<-"end;", ["stra", " ", "strb", " ", "strc"], [])
11
require "strscan"
12
$VERBOSE = nil
13
r = Ractor.new do
14
s = StringScanner.new("stra strb strc", true)
15
[
16
s.scan(/\\w+/),
17
s.scan(/\\s+/),
18
s.scan(/\\w+/),
19
s.scan(/\\s+/),
20
s.scan(/\\w+/),
21
s.scan(/\\w+/),
22
s.scan(/\\w+/)
23
]
24
end
25
puts r.take.compact
26
end;
27
end
28
end