Skip to content

Commit 3e993bc

Browse files
committed
Add spec for FiberError during #stop.
1 parent 6f02d33 commit 3e993bc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/async/task_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,26 @@
305305
expect(child_task).to_not be_alive
306306
end
307307
end
308+
309+
it "can stop a currently resumed task" do
310+
parent_task = nil
311+
312+
reactor.run do
313+
reactor.async do |task|
314+
parent_task = task
315+
316+
Fiber.new do
317+
task.async do
318+
parent_task.stop
319+
end
320+
end.resume
321+
322+
task.sleep(1)
323+
end
324+
end
325+
326+
expect(parent_task).to be_stopped
327+
end
308328

309329
it "can stop nested parent" do
310330
parent_task = nil

0 commit comments

Comments
 (0)