Merge pull request #954 from ruby-concurrency/clarify_to_enum_thread_test

Only run the CRuby bug-specific test on CRuby
This commit is contained in:
Benoit Daloze 2022-03-18 18:05:22 +01:00 committed by GitHub
commit 5f59cbdbd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 27 deletions

View File

@ -95,37 +95,35 @@ module Concurrent
end end
end end
context 'local jump error' do # These tests only make sense on CRuby as they test a workaround for CRuby bugs: https://github.com/ruby-concurrency/concurrent-ruby/issues/931
def execute if Concurrent.on_cruby?
Thread.new do context 'local jump error' do
executor = SafeTaskExecutor.new(-> { yield 42 }) def execute
@result = executor.execute Thread.new do
end.join executor = SafeTaskExecutor.new(-> { yield 42 })
end @result = executor.execute
end.join
end
subject do subject do
to_enum(:execute).first to_enum(:execute).first
@result @result
end end
it 'should return success' do it 'should return success' do
(pending('possible local jump bug on JRuby https://github.com/jruby/jruby/issues/7136'); fails) if Concurrent.on_jruby? success, _value, _reason = subject
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby? expect(success).to be_truthy
success, _value, _reason = subject end
expect(success).to be_truthy
end
it 'should return a nil value' do it 'should return a nil value' do
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby? _success, value, _reason = subject
_success, value, _reason = subject expect(value).to be_nil
expect(value).to be_nil end
end
it 'should return a nil reason' do it 'should return a nil reason' do
(pending('possible local jump bug on JRuby https://github.com/jruby/jruby/issues/7136'); fails) if Concurrent.on_jruby? _success, _value, reason = subject
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby? expect(reason).to be_nil
_success, _value, reason = subject end
expect(reason).to be_nil
end end
end end
end end