summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/shared/partially_closable_sockets.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/socket/shared/partially_closable_sockets.rb')
-rw-r--r--spec/ruby/library/socket/shared/partially_closable_sockets.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/socket/shared/partially_closable_sockets.rb b/spec/ruby/library/socket/shared/partially_closable_sockets.rb
new file mode 100644
index 0000000000..b1c2ebabe1
--- /dev/null
+++ b/spec/ruby/library/socket/shared/partially_closable_sockets.rb
@@ -0,0 +1,13 @@
+describe :partially_closable_sockets, shared: true do
+ it "if the write end is closed then the other side can read past EOF without blocking" do
+ @s1.write("foo")
+ @s1.close_write
+ @s2.read("foo".size + 1).should == "foo"
+ end
+
+ it "closing the write end ensures that the other side can read until EOF" do
+ @s1.write("hello world")
+ @s1.close_write
+ @s2.read.should == "hello world"
+ end
+end