diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-28 19:50:06 +0000 |
commit | 4fbb9aa3cb6c31ec128bfb31f59efa66d66adba4 (patch) | |
tree | 84a654b260261fe172f2584f60b3ba93e59f841d /spec/ruby/library/stringio | |
parent | b864bd05bff2a61d55b08deb92e969f9fa55e07c (diff) |
Update to ruby/spec@6f38a82
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/stringio')
-rw-r--r-- | spec/ruby/library/stringio/close_read_spec.rb | 7 | ||||
-rw-r--r-- | spec/ruby/library/stringio/close_spec.rb | 15 | ||||
-rw-r--r-- | spec/ruby/library/stringio/close_write_spec.rb | 7 | ||||
-rw-r--r-- | spec/ruby/library/stringio/external_encoding_spec.rb | 16 | ||||
-rw-r--r-- | spec/ruby/library/stringio/read_nonblock_spec.rb | 9 |
5 files changed, 21 insertions, 33 deletions
diff --git a/spec/ruby/library/stringio/close_read_spec.rb b/spec/ruby/library/stringio/close_read_spec.rb index 48630e0a7b..05d6c9f7d2 100644 --- a/spec/ruby/library/stringio/close_read_spec.rb +++ b/spec/ruby/library/stringio/close_read_spec.rb @@ -26,11 +26,6 @@ describe "StringIO#close_read" do io = StringIO.new("example") io.close_read - ruby_version_is ''...'2.3' do - lambda { io.close_read }.should raise_error(IOError) - end - ruby_version_is '2.3' do - io.close_read.should == nil - end + io.close_read.should == nil end end diff --git a/spec/ruby/library/stringio/close_spec.rb b/spec/ruby/library/stringio/close_spec.rb index 592dfdf526..a5a931aff1 100644 --- a/spec/ruby/library/stringio/close_spec.rb +++ b/spec/ruby/library/stringio/close_spec.rb @@ -16,17 +16,8 @@ describe "StringIO#close" do lambda { @io.write('x') }.should raise_error(IOError) end - ruby_version_is ''...'2.3' do - it "raises an IOError when self was already closed" do - @io.close - lambda { @io.close }.should raise_error(IOError) - end - end - - ruby_version_is "2.3" do - it "does not raise anything when self was already closed" do - @io.close - lambda { @io.close }.should_not raise_error(IOError) - end + it "does not raise anything when self was already closed" do + @io.close + lambda { @io.close }.should_not raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/close_write_spec.rb b/spec/ruby/library/stringio/close_write_spec.rb index f6292a9253..8a7ac12581 100644 --- a/spec/ruby/library/stringio/close_write_spec.rb +++ b/spec/ruby/library/stringio/close_write_spec.rb @@ -26,11 +26,6 @@ describe "StringIO#close_write" do io = StringIO.new("example") io.close_write - ruby_version_is ''...'2.3' do - lambda { io.close_write }.should raise_error(IOError) - end - ruby_version_is '2.3' do - io.close_write.should == nil - end + io.close_write.should == nil end end diff --git a/spec/ruby/library/stringio/external_encoding_spec.rb b/spec/ruby/library/stringio/external_encoding_spec.rb index 1a57081287..9c3d4041e5 100644 --- a/spec/ruby/library/stringio/external_encoding_spec.rb +++ b/spec/ruby/library/stringio/external_encoding_spec.rb @@ -8,14 +8,12 @@ describe "StringIO#external_encoding" do io.external_encoding.should == Encoding::EUC_JP end - ruby_version_is "2.3" do - it "does not set the encoding of its buffer string if the string is frozen" do - str = "foo".freeze - enc = str.encoding - io = StringIO.new(str) - io.set_encoding Encoding::EUC_JP - io.external_encoding.should == Encoding::EUC_JP - str.encoding.should == enc - end + it "does not set the encoding of its buffer string if the string is frozen" do + str = "foo".freeze + enc = str.encoding + io = StringIO.new(str) + io.set_encoding Encoding::EUC_JP + io.external_encoding.should == Encoding::EUC_JP + str.encoding.should == enc end end diff --git a/spec/ruby/library/stringio/read_nonblock_spec.rb b/spec/ruby/library/stringio/read_nonblock_spec.rb index 88728fcc18..7a79eef3c5 100644 --- a/spec/ruby/library/stringio/read_nonblock_spec.rb +++ b/spec/ruby/library/stringio/read_nonblock_spec.rb @@ -18,3 +18,12 @@ end describe "StringIO#read_nonblock when passed length" do it_behaves_like :stringio_sysread_length, :read_nonblock end + +describe "StringIO#read_nonblock" do + + it "accepts an exception option" do + stringio = StringIO.new('foo') + stringio.read_nonblock(3, exception: false).should == 'foo' + end + +end |