Skip to content

Commit b3209f4

Browse files
Cover idempotent channel close behavior.
Assisted-By: devx/3236e566-7538-432e-a30a-2bdf37265ed4
1 parent 5ff3943 commit b3209f4

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test/async/container/channel.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@
3030
expect(channel.receive).to be_nil
3131
end
3232

33+
with "#close" do
34+
it "can close more than once" do
35+
channel.close
36+
37+
expect do
38+
channel.close
39+
end.not.to raise_exception
40+
end
41+
42+
it "can close the input end after it was already closed" do
43+
channel.in.close
44+
45+
expect do
46+
channel.close_read
47+
end.not.to raise_exception
48+
end
49+
50+
it "can close the output end after it was already closed" do
51+
channel.out.close
52+
53+
expect do
54+
channel.close_write
55+
end.not.to raise_exception
56+
end
57+
end
58+
3359
with "timeout" do
3460
let(:channel) {subject.new(timeout: 0.001)}
3561

0 commit comments

Comments
 (0)