diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-05-03 12:28:29 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-05-03 12:28:29 +0200 |
commit | 5aaa75e7c1f4b7912c10ffdcb1cac581e20eda39 (patch) | |
tree | e1694f5a4a5558884b1b8f3890b186793e5e982f /spec/ruby/core/io | |
parent | f646d20aaeb8f02bcd3d0c5c3f5a372da654502a (diff) | |
download | ruby-5aaa75e7c1f4b7912c10ffdcb1cac581e20eda39.tar.gz |
Update to ruby/spec@032ee74
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r-- | spec/ruby/core/io/close_on_exec_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/io/close_read_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/close_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/close_write_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/dup_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/io/eof_spec.rb | 26 | ||||
-rw-r--r-- | spec/ruby/core/io/gets_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/io/pipe_spec.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/io/popen_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/io/read_nonblock_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/read_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/reopen_spec.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/io/rewind_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/seek_spec.rb | 6 | ||||
-rw-r--r-- | spec/ruby/core/io/shared/new.rb | 12 | ||||
-rw-r--r-- | spec/ruby/core/io/shared/pos.rb | 2 | ||||
-rw-r--r-- | spec/ruby/core/io/ungetc_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/core/io/write_nonblock_spec.rb | 2 |
18 files changed, 60 insertions, 60 deletions
diff --git a/spec/ruby/core/io/close_on_exec_spec.rb b/spec/ruby/core/io/close_on_exec_spec.rb index f837bb56af..91bd3c8c40 100644 --- a/spec/ruby/core/io/close_on_exec_spec.rb +++ b/spec/ruby/core/io/close_on_exec_spec.rb @@ -14,24 +14,24 @@ describe "IO#close_on_exec=" 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 + @io.should.close_on_exec? end it "sets the close-on-exec flag if non-false" do @io.close_on_exec = :true - @io.close_on_exec?.should == true + @io.should.close_on_exec? end it "unsets the close-on-exec flag if false" do @io.close_on_exec = true @io.close_on_exec = false - @io.close_on_exec?.should == false + @io.should_not.close_on_exec? end it "unsets the close-on-exec flag if nil" do @io.close_on_exec = true @io.close_on_exec = nil - @io.close_on_exec?.should == false + @io.should_not.close_on_exec? end it "ensures the IO's file descriptor is closed in exec'ed processes" do @@ -64,12 +64,12 @@ describe "IO#close_on_exec?" do guard -> { platform_is_not :windows } do it "returns true by default" do - @io.close_on_exec?.should == true + @io.should.close_on_exec? end it "returns true if set" do @io.close_on_exec = true - @io.close_on_exec?.should == true + @io.should.close_on_exec? end it "raises IOError if called on a closed IO" do diff --git a/spec/ruby/core/io/close_read_spec.rb b/spec/ruby/core/io/close_read_spec.rb index 6fa4fc8ff8..26454bfddd 100644 --- a/spec/ruby/core/io/close_read_spec.rb +++ b/spec/ruby/core/io/close_read_spec.rb @@ -49,7 +49,7 @@ describe "IO#close_read" do io.close_read - io.closed?.should == true + io.should.closed? end it "does nothing on closed stream" do diff --git a/spec/ruby/core/io/close_spec.rb b/spec/ruby/core/io/close_spec.rb index 37c8ab5a12..dda82b34de 100644 --- a/spec/ruby/core/io/close_spec.rb +++ b/spec/ruby/core/io/close_spec.rb @@ -14,7 +14,7 @@ describe "IO#close" do it "closes the stream" do @io.close - @io.closed?.should == true + @io.should.closed? end it "returns nil" do diff --git a/spec/ruby/core/io/close_write_spec.rb b/spec/ruby/core/io/close_write_spec.rb index 75e1577654..14835e4e2c 100644 --- a/spec/ruby/core/io/close_write_spec.rb +++ b/spec/ruby/core/io/close_write_spec.rb @@ -45,7 +45,7 @@ describe "IO#close_write" do io.close_write - io.closed?.should == true + io.should.closed? end it "flushes and closes the write stream" do diff --git a/spec/ruby/core/io/dup_spec.rb b/spec/ruby/core/io/dup_spec.rb index de32c5e347..8cadaee118 100644 --- a/spec/ruby/core/io/dup_spec.rb +++ b/spec/ruby/core/io/dup_spec.rb @@ -51,16 +51,16 @@ end @i.close -> { @f.gets }.should_not raise_error(Exception) - @i.closed?.should == true - @f.closed?.should == false + @i.should.closed? + @f.should_not.closed? end it "allows closing the original IO without affecting the new one" do @f.close -> { @i.gets }.should_not raise_error(Exception) - @i.closed?.should == false - @f.closed?.should == true + @i.should_not.closed? + @f.should.closed? end it "raises IOError on closed stream" do @@ -71,7 +71,7 @@ end @f.close_on_exec = true dup = @f.dup begin - dup.close_on_exec?.should == true + dup.should.close_on_exec? ensure dup.close end @@ -79,7 +79,7 @@ end @f.close_on_exec = false dup = @f.dup begin - dup.close_on_exec?.should == true + dup.should.close_on_exec? ensure dup.close end diff --git a/spec/ruby/core/io/eof_spec.rb b/spec/ruby/core/io/eof_spec.rb index 8fd3c37132..315345d942 100644 --- a/spec/ruby/core/io/eof_spec.rb +++ b/spec/ruby/core/io/eof_spec.rb @@ -12,7 +12,7 @@ describe "IO#eof?" do end it "returns true on an empty stream that has just been opened" do - File.open(@name) { |empty| empty.eof?.should == true } + File.open(@name) { |empty| empty.should.eof? } end it "raises IOError on stream not opened for reading" do @@ -34,35 +34,35 @@ describe "IO#eof?" do it "returns false when not at end of file" do @io.read 1 - @io.eof?.should == false + @io.should_not.eof? end it "returns true after reading with read with no parameters" do @io.read() - @io.eof?.should == true + @io.should.eof? end it "returns true after reading with read" do @io.read(File.size(@name)) - @io.eof?.should == true + @io.should.eof? end it "returns true after reading with sysread" do @io.sysread(File.size(@name)) - @io.eof?.should == true + @io.should.eof? end it "returns true after reading with readlines" do @io.readlines - @io.eof?.should == true + @io.should.eof? end it "returns false on just opened non-empty stream" do - @io.eof?.should == false + @io.should_not.eof? end it "does not consume the data from the stream" do - @io.eof?.should == false + @io.should_not.eof? @io.getc.should == 'V' end @@ -78,7 +78,7 @@ describe "IO#eof?" do it "returns true on one-byte stream after single-byte read" do File.open(File.dirname(__FILE__) + '/fixtures/one_byte.txt') { |one_byte| one_byte.read(1) - one_byte.eof?.should == true + one_byte.should.eof? } end end @@ -92,16 +92,16 @@ describe "IO#eof?" do it "returns true on receiving side of Pipe when writing side is closed" do @r, @w = IO.pipe @w.close - @r.eof?.should == true + @r.should.eof? end it "returns false on receiving side of Pipe when writing side wrote some data" do @r, @w = IO.pipe @w.puts "hello" - @r.eof?.should == false + @r.should_not.eof? @w.close - @r.eof?.should == false + @r.should_not.eof? @r.read - @r.eof?.should == true + @r.should.eof? end end diff --git a/spec/ruby/core/io/gets_spec.rb b/spec/ruby/core/io/gets_spec.rb index 39b2108476..a3cd180b66 100644 --- a/spec/ruby/core/io/gets_spec.rb +++ b/spec/ruby/core/io/gets_spec.rb @@ -41,7 +41,7 @@ describe "IO#gets" do ruby_version_is ''...'2.7' do it "returns tainted strings" do while line = @io.gets - line.tainted?.should == true + line.should.tainted? end end end @@ -67,7 +67,7 @@ describe "IO#gets" do ruby_version_is ''...'2.7' do it "returns tainted strings" do while line = @io.gets(nil) - line.tainted?.should == true + line.should.tainted? end end end @@ -103,7 +103,7 @@ describe "IO#gets" do ruby_version_is ''...'2.7' do it "returns tainted strings" do while line = @io.gets("") - line.tainted?.should == true + line.should.tainted? end end end @@ -129,7 +129,7 @@ describe "IO#gets" do ruby_version_is ''...'2.7' do it "returns tainted strings" do while line = @io.gets("la") - line.tainted?.should == true + line.should.tainted? end end end diff --git a/spec/ruby/core/io/pipe_spec.rb b/spec/ruby/core/io/pipe_spec.rb index a7dcb7fab8..2f2cf06f4d 100644 --- a/spec/ruby/core/io/pipe_spec.rb +++ b/spec/ruby/core/io/pipe_spec.rb @@ -44,8 +44,8 @@ describe "IO.pipe" do r, w = IO.pipe do |_r, _w| [_r, _w] end - r.closed?.should == true - w.closed?.should == true + r.should.closed? + w.should.closed? end it "closes both IO objects when the block raises" do @@ -57,8 +57,8 @@ describe "IO.pipe" do raise RuntimeError end end.should raise_error(RuntimeError) - r.closed?.should == true - w.closed?.should == true + r.should.closed? + w.should.closed? end it "allows IO objects to be closed within the block" do @@ -67,8 +67,8 @@ describe "IO.pipe" do _w.close [_r, _w] end - r.closed?.should == true - w.closed?.should == true + r.should.closed? + w.should.closed? end end end diff --git a/spec/ruby/core/io/popen_spec.rb b/spec/ruby/core/io/popen_spec.rb index 4f873e61cd..e9d32c5c7d 100644 --- a/spec/ruby/core/io/popen_spec.rb +++ b/spec/ruby/core/io/popen_spec.rb @@ -77,10 +77,10 @@ describe "IO.popen" do Process.kill "KILL", pid @io.close platform_is_not :windows do - $?.signaled?.should == true + $?.should.signaled? end platform_is :windows do - $?.exited?.should == true + $?.should.exited? end end diff --git a/spec/ruby/core/io/read_nonblock_spec.rb b/spec/ruby/core/io/read_nonblock_spec.rb index 63ccab5a44..e50531d336 100644 --- a/spec/ruby/core/io/read_nonblock_spec.rb +++ b/spec/ruby/core/io/read_nonblock_spec.rb @@ -46,7 +46,7 @@ describe "IO#read_nonblock" do require 'io/nonblock' @write.write "abc" @read.read_nonblock(1).should == "a" - @read.nonblock?.should == true + @read.should.nonblock? end end diff --git a/spec/ruby/core/io/read_spec.rb b/spec/ruby/core/io/read_spec.rb index 1e9a8d2a4f..841e693f37 100644 --- a/spec/ruby/core/io/read_spec.rb +++ b/spec/ruby/core/io/read_spec.rb @@ -216,7 +216,7 @@ describe "IO#read" do it "is at end-of-file when everything has been read" do @io.read - @io.eof?.should == true + @io.should.eof? end it "reads the contents of a file" do diff --git a/spec/ruby/core/io/reopen_spec.rb b/spec/ruby/core/io/reopen_spec.rb index faef80f513..8ff0f217f4 100644 --- a/spec/ruby/core/io/reopen_spec.rb +++ b/spec/ruby/core/io/reopen_spec.rb @@ -150,11 +150,11 @@ describe "IO#reopen with a String" do @io.close_on_exec = true @io.reopen @other_name - @io.close_on_exec?.should == true + @io.should.close_on_exec? @io.close_on_exec = false @io.reopen @other_name - @io.close_on_exec?.should == true + @io.should.close_on_exec? end it "creates the file if it doesn't exist if the IO is opened in write mode" do @@ -293,12 +293,12 @@ describe "IO#reopen with an IO" do @other_io.close_on_exec = true @io.close_on_exec = true @io.reopen @other_io - @io.close_on_exec?.should == true + @io.should.close_on_exec? @other_io.close_on_exec = false @io.close_on_exec = false @io.reopen @other_io - @io.close_on_exec?.should == true + @io.should.close_on_exec? end it "may change the class of the instance" do diff --git a/spec/ruby/core/io/rewind_spec.rb b/spec/ruby/core/io/rewind_spec.rb index 954d56d30c..649041afaf 100644 --- a/spec/ruby/core/io/rewind_spec.rb +++ b/spec/ruby/core/io/rewind_spec.rb @@ -21,7 +21,7 @@ describe "IO#rewind" do it "positions the instance to the beginning of input and clears EOF" do value = @io.read @io.rewind - @io.eof?.should == false + @io.should_not.eof? value.should == @io.read end diff --git a/spec/ruby/core/io/seek_spec.rb b/spec/ruby/core/io/seek_spec.rb index 7e9c308272..2fa4a73ac9 100644 --- a/spec/ruby/core/io/seek_spec.rb +++ b/spec/ruby/core/io/seek_spec.rb @@ -44,21 +44,21 @@ describe "IO#seek" do it "moves the read position and clears EOF with SEEK_SET" do value = @io.read @io.seek(0, IO::SEEK_SET) - @io.eof?.should == false + @io.should_not.eof? value.should == @io.read end it "moves the read position and clears EOF with SEEK_CUR" do value = @io.read @io.seek(-1, IO::SEEK_CUR) - @io.eof?.should == false + @io.should_not.eof? value[-1].should == @io.read[0] end it "moves the read position and clears EOF with SEEK_END" do value = @io.read @io.seek(-1, IO::SEEK_END) - @io.eof?.should == false + @io.should_not.eof? value[-1].should == @io.read[0] end diff --git a/spec/ruby/core/io/shared/new.rb b/spec/ruby/core/io/shared/new.rb index 27d32f97ed..87f3001862 100644 --- a/spec/ruby/core/io/shared/new.rb +++ b/spec/ruby/core/io/shared/new.rb @@ -148,22 +148,22 @@ describe :io_new, shared: true do it "sets binmode from mode string" do @io = IO.send(@method, @fd, 'wb') - @io.binmode?.should == true + @io.should.binmode? end it "does not set binmode without being asked" do @io = IO.send(@method, @fd, 'w') - @io.binmode?.should == false + @io.should_not.binmode? end it "sets binmode from :binmode option" do @io = IO.send(@method, @fd, 'w', binmode: true) - @io.binmode?.should == true + @io.should.binmode? end it "does not set binmode from false :binmode" do @io = IO.send(@method, @fd, 'w', binmode: false) - @io.binmode?.should == false + @io.should_not.binmode? end it "sets external encoding to binary with binmode in mode string" do @@ -270,13 +270,13 @@ describe :io_new, shared: true do it "accepts an :autoclose option" do @io = IO.send(@method, @fd, 'w', autoclose: false) - @io.autoclose?.should == false + @io.should_not.autoclose? @io.autoclose = true end it "accepts any truthy option :autoclose" do @io = IO.send(@method, @fd, 'w', autoclose: 42) - @io.autoclose?.should == true + @io.should.autoclose? end end diff --git a/spec/ruby/core/io/shared/pos.rb b/spec/ruby/core/io/shared/pos.rb index fb6d8087bc..0b4d1e13b3 100644 --- a/spec/ruby/core/io/shared/pos.rb +++ b/spec/ruby/core/io/shared/pos.rb @@ -27,7 +27,7 @@ describe :io_pos, shared: true do io.read 1 io.read 1 io.send(@method) - io.eof?.should == false + io.should_not.eof? end end end diff --git a/spec/ruby/core/io/ungetc_spec.rb b/spec/ruby/core/io/ungetc_spec.rb index 4be0e3aa8b..85c15b5a71 100644 --- a/spec/ruby/core/io/ungetc_spec.rb +++ b/spec/ruby/core/io/ungetc_spec.rb @@ -74,10 +74,10 @@ describe "IO#ungetc" do touch(@empty) File.open(@empty) { |empty| - empty.eof?.should == true + empty.should.eof? empty.getc.should == nil empty.ungetc(100) - empty.eof?.should == false + empty.should_not.eof? } end diff --git a/spec/ruby/core/io/write_nonblock_spec.rb b/spec/ruby/core/io/write_nonblock_spec.rb index 5474e5c6ce..a8b9ce0a36 100644 --- a/spec/ruby/core/io/write_nonblock_spec.rb +++ b/spec/ruby/core/io/write_nonblock_spec.rb @@ -79,7 +79,7 @@ describe 'IO#write_nonblock' do it 'sets the IO in nonblock mode' do require 'io/nonblock' @write.write_nonblock('a') - @write.nonblock?.should == true + @write.should.nonblock? end end end |