Skip to content

Commit

Permalink
Add failing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 24, 2024
1 parent 44a155c commit c1203be
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/io/event/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def transfer
end

expect(events).to be == [:process_finished]
expect(result.success?).to be == true
expect(result).to be(:success?)
end

it "can wait for a process to terminate" do
Expand All @@ -581,6 +581,29 @@ def transfer
expect(events).to be == [:process_finished]
expect(result).to be(:success?)
end

it "can wait for a process which never starts" do
result = nil
events = []

fiber = Fiber.new do
pid = ::Process.fork{exit(-1)}
sleep 0.001

result = selector.process_wait(Fiber.current, pid, 0)
expect(result).not.to be(:success?)
events << :process_finished
end

fiber.transfer

while fiber.alive?
selector.select(1)
end

expect(events).to be == [:process_finished]
expect(result).not.to be(:success?)
end
end

with "#resume" do
Expand Down

0 comments on commit c1203be

Please sign in to comment.