summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/shared
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-27 12:30:05 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-27 12:30:05 +0000
commit9dc121cc577ae7a010bca7efedb79088e3cf7331 (patch)
treec11a153c7eac91a1e19ed058d5c28f0f7d583622 /spec/ruby/core/io/shared
parentfc1f3f14d386b557281ff9a8f19da060befe182e (diff)
Update to ruby/spec@a454137
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/io/shared')
-rw-r--r--spec/ruby/core/io/shared/write.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/io/shared/write.rb b/spec/ruby/core/io/shared/write.rb
index 9490a848d7..bca96da81c 100644
--- a/spec/ruby/core/io/shared/write.rb
+++ b/spec/ruby/core/io/shared/write.rb
@@ -69,4 +69,25 @@ describe :io_write, shared: true do
lambda { IOSpecs.closed_io.send(@method, "hello") }.should raise_error(IOError)
end
+ describe "on a pipe" do
+ before :each do
+ @r, @w = IO.pipe
+ end
+
+ after :each do
+ @r.close
+ @w.close
+ end
+
+ it "writes the given String to the pipe" do
+ @w.send(@method, "foo")
+ @w.close
+ @r.read.should == "foo"
+ end
+
+ it "raises Errno::EPIPE if the read end is closed" do
+ @r.close
+ -> { @w.send(@method, "foo") }.should raise_error(Errno::EPIPE, "Broken pipe")
+ end
+ end
end