File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44describe XXhash do
55 it 'is marked as ractor-safe' do
6- skip ( "Ractorrs are not supported in this version of ruby(#{ RUBY_VERSION } )" ) unless defined? ( Ractor )
6+ skip ( "Ractors are not supported in this version of ruby(#{ RUBY_VERSION } )" ) unless defined? ( Ractor )
77
8- ractor = Ractor . new do
9- Ractor . yield XXhash . xxh32 ( Ractor . receive )
10- end
8+ if defined? ( Ractor ::Port )
9+ ractor = Ractor . new do
10+ msg , reply_port = Ractor . receive
11+ reply_port << XXhash . xxh32 ( msg )
12+ end
13+
14+ reply = Ractor ::Port . new
15+ ractor << [ "test" , reply ]
1116
12- ractor . send ( 'test' )
13- assert_equal ractor . take , XXhash . xxh32 ( 'test' )
17+ assert_equal reply . receive , XXhash . xxh32 ( "test" )
18+ else
19+ ractor = Ractor . new do
20+ Ractor . yield XXhash . xxh32 ( Ractor . receive )
21+ end
22+
23+ ractor . send ( 'test' )
24+ assert_equal ractor . take , XXhash . xxh32 ( 'test' )
25+ end
1426 end
1527
1628 it 'returns 32-bit hash' do
You can’t perform that action at this time.
0 commit comments