summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/shared/partially_closable_sockets.rb
blob: 1bdff08bf64148b1bedaedd60a111d3e280c3240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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