From d781f6e0810b2465b5a3ae922556ef05088e70fb Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 18 Mar 2022 17:31:40 +0100 Subject: [PATCH] Only run the CRuby bug-specific test on CRuby * See https://github.com/ruby-concurrency/concurrent-ruby/issues/931#issuecomment-1072579667 --- .../executor/safe_task_executor_spec.rb | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/spec/concurrent/executor/safe_task_executor_spec.rb b/spec/concurrent/executor/safe_task_executor_spec.rb index 2dff82d9..542322d2 100644 --- a/spec/concurrent/executor/safe_task_executor_spec.rb +++ b/spec/concurrent/executor/safe_task_executor_spec.rb @@ -95,37 +95,35 @@ module Concurrent end end - context 'local jump error' do - def execute - Thread.new do - executor = SafeTaskExecutor.new(-> { yield 42 }) - @result = executor.execute - end.join - end + # These tests only make sense on CRuby as they test a workaround for CRuby bugs: https://github.com/ruby-concurrency/concurrent-ruby/issues/931 + if Concurrent.on_cruby? + context 'local jump error' do + def execute + Thread.new do + executor = SafeTaskExecutor.new(-> { yield 42 }) + @result = executor.execute + end.join + end - subject do - to_enum(:execute).first - @result - end + subject do + to_enum(:execute).first + @result + end - it 'should return success' do - (pending('possible local jump bug on JRuby https://github.com/jruby/jruby/issues/7136'); fails) if Concurrent.on_jruby? - skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby? - success, _value, _reason = subject - expect(success).to be_truthy - end + it 'should return success' do + success, _value, _reason = subject + expect(success).to be_truthy + end - 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 - expect(value).to be_nil - end + it 'should return a nil value' do + _success, value, _reason = subject + expect(value).to be_nil + end - 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? - skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby? - _success, _value, reason = subject - expect(reason).to be_nil + it 'should return a nil reason' do + _success, _value, reason = subject + expect(reason).to be_nil + end end end end