mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/timeout] Simplify test
https://github.com/ruby/timeout/commit/db017da726
This commit is contained in:
parent
610375edfc
commit
70d84a5f3d
@ -172,23 +172,17 @@ class TestTimeout < Test::Unit::TestCase
|
||||
end;
|
||||
end
|
||||
|
||||
# https://github.com/ruby/timeout/issues/24
|
||||
def test_handling_enclosed_threadgroup
|
||||
# The problem "add: can't move from the enclosed thread group" #24,
|
||||
# happens when the timeout_thread is created in an enclosed ThreadGroup.
|
||||
assert_separately(%w[-rtimeout], <<-'end;')
|
||||
t1 = Thread.new {
|
||||
Thread.stop
|
||||
assert_block do
|
||||
Timeout.timeout(0.1) {}
|
||||
true
|
||||
end
|
||||
}
|
||||
sleep 0.1 while t1.status != 'sleep'
|
||||
group = ThreadGroup.new
|
||||
group.add(t1)
|
||||
group.enclose
|
||||
t1.run
|
||||
t1.join
|
||||
Thread.new {
|
||||
t = Thread.current
|
||||
group = ThreadGroup.new
|
||||
group.add(t)
|
||||
group.enclose
|
||||
|
||||
assert_equal 42, Timeout.timeout(1) { 42 }
|
||||
}.join
|
||||
end;
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user