mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@6f38a82
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b864bd05bf
commit
4fbb9aa3cb
145 changed files with 2847 additions and 2596 deletions
|
@ -41,9 +41,7 @@ describe "IO.binread" do
|
|||
lambda { IO.binread @fname, -1 }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
ruby_version_is "2.3" do # MRI leaks the fd on older versions
|
||||
it "raises an Errno::EINVAL when not passed a valid offset" do
|
||||
lambda { IO.binread @fname, 0, -1 }.should raise_error(Errno::EINVAL)
|
||||
end
|
||||
it "raises an Errno::EINVAL when not passed a valid offset" do
|
||||
lambda { IO.binread @fname, 0, -1 }.should raise_error(Errno::EINVAL)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,17 +11,7 @@ describe "IO#close_on_exec=" do
|
|||
rm_r @name
|
||||
end
|
||||
|
||||
guard -> { platform_is :windows and ruby_version_is ""..."2.3" } do
|
||||
it "returns false from #respond_to?" do
|
||||
@io.respond_to?(:close_on_exec=).should be_false
|
||||
end
|
||||
|
||||
it "raises a NotImplementedError when called" do
|
||||
lambda { @io.close_on_exec = true }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
||||
|
||||
guard -> { platform_is_not :windows or ruby_version_is "2.3" } do
|
||||
guard -> { platform_is_not :windows } do
|
||||
it "sets the close-on-exec flag if true" do
|
||||
@io.close_on_exec = true
|
||||
@io.close_on_exec?.should == true
|
||||
|
@ -72,17 +62,7 @@ describe "IO#close_on_exec?" do
|
|||
rm_r @name
|
||||
end
|
||||
|
||||
guard -> { platform_is :windows and ruby_version_is ""..."2.3" } do
|
||||
it "returns false from #respond_to?" do
|
||||
@io.respond_to?(:close_on_exec?).should be_false
|
||||
end
|
||||
|
||||
it "raises a NotImplementedError when called" do
|
||||
lambda { @io.close_on_exec? }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
||||
|
||||
guard -> { platform_is_not :windows or ruby_version_is "2.3" } do
|
||||
guard -> { platform_is_not :windows } do
|
||||
it "returns true by default" do
|
||||
@io.close_on_exec?.should == true
|
||||
end
|
||||
|
|
|
@ -19,20 +19,10 @@ describe "IO#close_read" do
|
|||
lambda { @io.read }.should raise_error(IOError)
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.3' do
|
||||
it "raises an IOError on subsequent invocations" do
|
||||
@io.close_read
|
||||
it "does nothing on subsequent invocations" do
|
||||
@io.close_read
|
||||
|
||||
lambda { @io.close_read }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is '2.3' do
|
||||
it "does nothing on subsequent invocations" do
|
||||
@io.close_read
|
||||
|
||||
@io.close_read.should be_nil
|
||||
end
|
||||
@io.close_read.should be_nil
|
||||
end
|
||||
|
||||
it "allows subsequent invocation of close" do
|
||||
|
@ -62,19 +52,9 @@ describe "IO#close_read" do
|
|||
io.closed?.should == true
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.3' do
|
||||
it "raises IOError on closed stream" do
|
||||
@io.close
|
||||
it "does nothing on closed stream" do
|
||||
@io.close
|
||||
|
||||
lambda { @io.close_read }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is '2.3' do
|
||||
it "does nothing on closed stream" do
|
||||
@io.close
|
||||
|
||||
@io.close_read.should be_nil
|
||||
end
|
||||
@io.close_read.should be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,19 +38,10 @@ describe "IO#close" do
|
|||
lambda { @io.write "data" }.should_not raise_error(IOError)
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.3' do
|
||||
it "raises an IOError if closed" do
|
||||
@io.close
|
||||
lambda { @io.close }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
it "does nothing if already closed" do
|
||||
@io.close
|
||||
|
||||
ruby_version_is "2.3" do
|
||||
it "does nothing if already closed" do
|
||||
@io.close
|
||||
|
||||
@io.close.should be_nil
|
||||
end
|
||||
@io.close.should be_nil
|
||||
end
|
||||
|
||||
ruby_version_is '2.5' do
|
||||
|
|
|
@ -18,20 +18,10 @@ describe "IO#close_write" do
|
|||
lambda { @io.write "attempt to write" }.should raise_error(IOError)
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.3' do
|
||||
it "raises an IOError on subsequent invocations" do
|
||||
@io.close_write
|
||||
it "does nothing on subsequent invocations" do
|
||||
@io.close_write
|
||||
|
||||
lambda { @io.close_write }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is '2.3' do
|
||||
it "does nothing on subsequent invocations" do
|
||||
@io.close_write
|
||||
|
||||
@io.close_write.should be_nil
|
||||
end
|
||||
@io.close_write.should be_nil
|
||||
end
|
||||
|
||||
it "allows subsequent invocation of close" do
|
||||
|
@ -66,19 +56,9 @@ describe "IO#close_write" do
|
|||
@io.read.should == "12345\n"
|
||||
end
|
||||
|
||||
ruby_version_is ''...'2.3' do
|
||||
it "raises IOError on closed stream" do
|
||||
@io.close
|
||||
it "does nothing on closed stream" do
|
||||
@io.close
|
||||
|
||||
lambda { @io.close_write }.should raise_error(IOError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is '2.3' do
|
||||
it "does nothing on closed stream" do
|
||||
@io.close
|
||||
|
||||
@io.close_write.should be_nil
|
||||
end
|
||||
@io.close_write.should be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,9 +37,7 @@ describe "IO#each_codepoint" do
|
|||
@io.close if @io
|
||||
end
|
||||
|
||||
ruby_version_is "2.3" do # earlier versions stay blocked
|
||||
it "raises an exception at incomplete character before EOF when conversion takes place" do
|
||||
lambda { @io.each_codepoint {} }.should raise_error(ArgumentError)
|
||||
end
|
||||
it "raises an exception at incomplete character before EOF when conversion takes place" do
|
||||
lambda { @io.each_codepoint {} }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,23 +22,21 @@ describe "IO#read_nonblock" do
|
|||
}
|
||||
end
|
||||
|
||||
ruby_version_is "2.3" do
|
||||
context "when exception option is set to false" do
|
||||
context "when there is no data" do
|
||||
it "returns :wait_readable" do
|
||||
@read.read_nonblock(5, exception: false).should == :wait_readable
|
||||
end
|
||||
context "when exception option is set to false" do
|
||||
context "when there is no data" do
|
||||
it "returns :wait_readable" do
|
||||
@read.read_nonblock(5, exception: false).should == :wait_readable
|
||||
end
|
||||
end
|
||||
|
||||
context "when the end is reached" do
|
||||
it "returns nil" do
|
||||
@write << "hello"
|
||||
@write.close
|
||||
context "when the end is reached" do
|
||||
it "returns nil" do
|
||||
@write << "hello"
|
||||
@write.close
|
||||
|
||||
@read.read_nonblock(5)
|
||||
@read.read_nonblock(5)
|
||||
|
||||
@read.read_nonblock(5, exception: false).should be_nil
|
||||
end
|
||||
@read.read_nonblock(5, exception: false).should be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,12 +66,10 @@ describe 'IO#write_nonblock' do
|
|||
}
|
||||
end
|
||||
|
||||
ruby_version_is "2.3" do
|
||||
context "when exception option is set to false" do
|
||||
it "returns :wait_writable when the operation would block" do
|
||||
loop { break if @write.write_nonblock("a" * 10_000, exception: false) == :wait_writable }
|
||||
1.should == 1
|
||||
end
|
||||
context "when exception option is set to false" do
|
||||
it "returns :wait_writable when the operation would block" do
|
||||
loop { break if @write.write_nonblock("a" * 10_000, exception: false) == :wait_writable }
|
||||
1.should == 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue