Skip to content

Commit 5f59cbd

Browse files
authored
Merge pull request #954 from ruby-concurrency/clarify_to_enum_thread_test
Only run the CRuby bug-specific test on CRuby
2 parents bf30bfd + d781f6e commit 5f59cbd

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

spec/concurrent/executor/safe_task_executor_spec.rb

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,35 @@ module Concurrent
9595
end
9696
end
9797

98-
context 'local jump error' do
99-
def execute
100-
Thread.new do
101-
executor = SafeTaskExecutor.new(-> { yield 42 })
102-
@result = executor.execute
103-
end.join
104-
end
105-
106-
subject do
107-
to_enum(:execute).first
108-
@result
109-
end
110-
111-
it 'should return success' do
112-
(pending('possible local jump bug on JRuby https://github.com/jruby/jruby/issues/7136'); fails) if Concurrent.on_jruby?
113-
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby?
114-
success, _value, _reason = subject
115-
expect(success).to be_truthy
116-
end
117-
118-
it 'should return a nil value' do
119-
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby?
120-
_success, value, _reason = subject
121-
expect(value).to be_nil
122-
end
123-
124-
it 'should return a nil reason' do
125-
(pending('possible local jump bug on JRuby https://github.com/jruby/jruby/issues/7136'); fails) if Concurrent.on_jruby?
126-
skip('the test does not make sense: https://github.com/ruby-concurrency/concurrent-ruby/issues/931') if Concurrent.on_truffleruby?
127-
_success, _value, reason = subject
128-
expect(reason).to be_nil
98+
# These tests only make sense on CRuby as they test a workaround for CRuby bugs: https://github.com/ruby-concurrency/concurrent-ruby/issues/931
99+
if Concurrent.on_cruby?
100+
context 'local jump error' do
101+
def execute
102+
Thread.new do
103+
executor = SafeTaskExecutor.new(-> { yield 42 })
104+
@result = executor.execute
105+
end.join
106+
end
107+
108+
subject do
109+
to_enum(:execute).first
110+
@result
111+
end
112+
113+
it 'should return success' do
114+
success, _value, _reason = subject
115+
expect(success).to be_truthy
116+
end
117+
118+
it 'should return a nil value' do
119+
_success, value, _reason = subject
120+
expect(value).to be_nil
121+
end
122+
123+
it 'should return a nil reason' do
124+
_success, _value, reason = subject
125+
expect(reason).to be_nil
126+
end
129127
end
130128
end
131129
end

0 commit comments

Comments
 (0)