diff options
Diffstat (limited to 'spec/rubyspec/library/socket/shared/partially_closable_sockets.rb')
-rw-r--r-- | spec/rubyspec/library/socket/shared/partially_closable_sockets.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/rubyspec/library/socket/shared/partially_closable_sockets.rb b/spec/rubyspec/library/socket/shared/partially_closable_sockets.rb new file mode 100644 index 0000000000..1309f15f85 --- /dev/null +++ b/spec/rubyspec/library/socket/shared/partially_closable_sockets.rb @@ -0,0 +1,13 @@ +describe "partially closable sockets", shared: true do + specify "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 + + specify "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 |