diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-27 12:30:05 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-27 12:30:05 +0000 |
commit | 9dc121cc577ae7a010bca7efedb79088e3cf7331 (patch) | |
tree | c11a153c7eac91a1e19ed058d5c28f0f7d583622 /spec/ruby/core/io | |
parent | fc1f3f14d386b557281ff9a8f19da060befe182e (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')
-rw-r--r-- | spec/ruby/core/io/pos_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/core/io/print_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/core/io/shared/write.rb | 21 |
3 files changed, 21 insertions, 2 deletions
diff --git a/spec/ruby/core/io/pos_spec.rb b/spec/ruby/core/io/pos_spec.rb index ca0a761c8f..e6cda2643d 100644 --- a/spec/ruby/core/io/pos_spec.rb +++ b/spec/ruby/core/io/pos_spec.rb @@ -9,4 +9,3 @@ end describe "IO#pos=" do it_behaves_like :io_set_pos, :pos= end - diff --git a/spec/ruby/core/io/print_spec.rb b/spec/ruby/core/io/print_spec.rb index a4a069361e..0dd48344ce 100644 --- a/spec/ruby/core/io/print_spec.rb +++ b/spec/ruby/core/io/print_spec.rb @@ -51,4 +51,3 @@ describe IO, "#print" do lambda { IOSpecs.closed_io.print("stuff") }.should raise_error(IOError) end end - 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 |