summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-07-27 11:15:50 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-03 12:47:51 +0900
commit43b95bafd57d04c8fb401d3a9b52aca3f5b4b0be (patch)
tree642b463fce3ff7c5d683eb6e8068cf2dfa2c14df /spec/ruby
parent84eb2bfab940fc9c6962c10ede7f72cee3fb9899 (diff)
delete deprecated IO-like methods
This commit deletes {IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which have been deprecated since c47c095b9740e7c19d6fdca29ab661c1089221d4. Note that String also has those methods. They are neither depreacted nor deleted because they are not aliases of counterpart each_something.
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/argf/bytes_spec.rb6
-rw-r--r--spec/ruby/core/argf/chars_spec.rb6
-rw-r--r--spec/ruby/core/argf/codepoints_spec.rb6
-rw-r--r--spec/ruby/core/argf/lines_spec.rb6
-rw-r--r--spec/ruby/core/io/bytes_spec.rb64
-rw-r--r--spec/ruby/core/io/chars_spec.rb12
-rw-r--r--spec/ruby/core/io/codepoints_spec.rb33
-rw-r--r--spec/ruby/core/io/each_codepoint_spec.rb2
-rw-r--r--spec/ruby/core/io/lines_spec.rb52
-rw-r--r--spec/ruby/library/stringio/bytes_spec.rb12
-rw-r--r--spec/ruby/library/stringio/chars_spec.rb12
-rw-r--r--spec/ruby/library/stringio/codepoints_spec.rb9
-rw-r--r--spec/ruby/library/stringio/each_char_spec.rb2
-rw-r--r--spec/ruby/library/stringio/each_codepoint_spec.rb2
-rw-r--r--spec/ruby/library/stringio/lines_spec.rb24
15 files changed, 137 insertions, 111 deletions
diff --git a/spec/ruby/core/argf/bytes_spec.rb b/spec/ruby/core/argf/bytes_spec.rb
index 71d07fabcb..58a7082fd2 100644
--- a/spec/ruby/core/argf/bytes_spec.rb
+++ b/spec/ruby/core/argf/bytes_spec.rb
@@ -1,6 +1,8 @@
require_relative '../../spec_helper'
require_relative 'shared/each_byte'
-describe "ARGF.bytes" do
- it_behaves_like :argf_each_byte, :bytes
+ruby_version_is ''...'2.8' do
+ describe "ARGF.bytes" do
+ it_behaves_like :argf_each_byte, :bytes
+ end
end
diff --git a/spec/ruby/core/argf/chars_spec.rb b/spec/ruby/core/argf/chars_spec.rb
index ee79ea763b..b5105effdf 100644
--- a/spec/ruby/core/argf/chars_spec.rb
+++ b/spec/ruby/core/argf/chars_spec.rb
@@ -1,6 +1,8 @@
require_relative '../../spec_helper'
require_relative 'shared/each_char'
-describe "ARGF.chars" do
- it_behaves_like :argf_each_char, :chars
+ruby_version_is ''...'2.8' do
+ describe "ARGF.chars" do
+ it_behaves_like :argf_each_char, :chars
+ end
end
diff --git a/spec/ruby/core/argf/codepoints_spec.rb b/spec/ruby/core/argf/codepoints_spec.rb
index 7aa8a761fe..d7b9d08aaa 100644
--- a/spec/ruby/core/argf/codepoints_spec.rb
+++ b/spec/ruby/core/argf/codepoints_spec.rb
@@ -1,6 +1,8 @@
require_relative '../../spec_helper'
require_relative 'shared/each_codepoint'
-describe "ARGF.codepoints" do
- it_behaves_like :argf_each_codepoint, :codepoints
+ruby_version_is ''...'2.8' do
+ describe "ARGF.codepoints" do
+ it_behaves_like :argf_each_codepoint, :codepoints
+ end
end
diff --git a/spec/ruby/core/argf/lines_spec.rb b/spec/ruby/core/argf/lines_spec.rb
index 6ca6ff1256..620db4312f 100644
--- a/spec/ruby/core/argf/lines_spec.rb
+++ b/spec/ruby/core/argf/lines_spec.rb
@@ -1,6 +1,8 @@
require_relative '../../spec_helper'
require_relative 'shared/each_line'
-describe "ARGF.lines" do
- it_behaves_like :argf_each_line, :lines
+ruby_version_is ''...'2.8' do
+ describe "ARGF.lines" do
+ it_behaves_like :argf_each_line, :lines
+ end
end
diff --git a/spec/ruby/core/io/bytes_spec.rb b/spec/ruby/core/io/bytes_spec.rb
index feeb493566..f0e993e8f0 100644
--- a/spec/ruby/core/io/bytes_spec.rb
+++ b/spec/ruby/core/io/bytes_spec.rb
@@ -2,42 +2,44 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
-describe "IO#bytes" do
- before :each do
- @io = IOSpecs.io_fixture "lines.txt"
- end
-
- after :each do
- @io.close unless @io.closed?
- end
+ruby_version_is ''...'2.8' do
+ describe "IO#bytes" do
+ before :each do
+ @io = IOSpecs.io_fixture "lines.txt"
+ end
- it "returns an enumerator of the next bytes from the stream" do
- enum = @io.bytes
- enum.should be_an_instance_of(Enumerator)
- @io.readline.should == "Voici la ligne une.\n"
- enum.first(5).should == [81, 117, 105, 32, 195]
- end
+ after :each do
+ @io.close unless @io.closed?
+ end
- it "yields each byte" do
- count = 0
- ScratchPad.record []
- @io.each_byte do |byte|
- ScratchPad << byte
- break if 4 < count += 1
+ it "returns an enumerator of the next bytes from the stream" do
+ enum = @io.bytes
+ enum.should be_an_instance_of(Enumerator)
+ @io.readline.should == "Voici la ligne une.\n"
+ enum.first(5).should == [81, 117, 105, 32, 195]
end
- ScratchPad.recorded.should == [86, 111, 105, 99, 105]
- end
+ it "yields each byte" do
+ count = 0
+ ScratchPad.record []
+ @io.each_byte do |byte|
+ ScratchPad << byte
+ break if 4 < count += 1
+ end
- it "raises an IOError on closed stream" do
- enum = IOSpecs.closed_io.bytes
- -> { enum.first }.should raise_error(IOError)
- end
+ ScratchPad.recorded.should == [86, 111, 105, 99, 105]
+ end
- it "raises an IOError on an enumerator for a stream that has been closed" do
- enum = @io.bytes
- enum.first.should == 86
- @io.close
- -> { enum.first }.should raise_error(IOError)
+ it "raises an IOError on closed stream" do
+ enum = IOSpecs.closed_io.bytes
+ -> { enum.first }.should raise_error(IOError)
+ end
+
+ it "raises an IOError on an enumerator for a stream that has been closed" do
+ enum = @io.bytes
+ enum.first.should == 86
+ @io.close
+ -> { enum.first }.should raise_error(IOError)
+ end
end
end
diff --git a/spec/ruby/core/io/chars_spec.rb b/spec/ruby/core/io/chars_spec.rb
index cd5dbbce4f..2efbdd7333 100644
--- a/spec/ruby/core/io/chars_spec.rb
+++ b/spec/ruby/core/io/chars_spec.rb
@@ -3,10 +3,12 @@ require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/chars'
-describe "IO#chars" do
- it_behaves_like :io_chars, :chars
-end
+ruby_version_is ''...'2.8' do
+ describe "IO#chars" do
+ it_behaves_like :io_chars, :chars
+ end
-describe "IO#chars" do
- it_behaves_like :io_chars_empty, :chars
+ describe "IO#chars" do
+ it_behaves_like :io_chars_empty, :chars
+ end
end
diff --git a/spec/ruby/core/io/codepoints_spec.rb b/spec/ruby/core/io/codepoints_spec.rb
index 915d99c027..1138989427 100644
--- a/spec/ruby/core/io/codepoints_spec.rb
+++ b/spec/ruby/core/io/codepoints_spec.rb
@@ -2,24 +2,27 @@ require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/codepoints'
-# See redmine #1667
-describe "IO#codepoints" do
- it_behaves_like :io_codepoints, :codepoints
-end
+ruby_version_is ''...'2.8' do
-describe "IO#codepoints" do
- before :each do
- @io = IOSpecs.io_fixture "lines.txt"
+ # See redmine #1667
+ describe "IO#codepoints" do
+ it_behaves_like :io_codepoints, :codepoints
end
- after :each do
- @io.close unless @io.closed?
- end
+ describe "IO#codepoints" do
+ before :each do
+ @io = IOSpecs.io_fixture "lines.txt"
+ end
+
+ after :each do
+ @io.close unless @io.closed?
+ end
- it "calls the given block" do
- r = []
- @io.codepoints { |c| r << c }
- r[24].should == 232
- r.last.should == 10
+ it "calls the given block" do
+ r = []
+ @io.codepoints { |c| r << c }
+ r[24].should == 232
+ r.last.should == 10
+ end
end
end
diff --git a/spec/ruby/core/io/each_codepoint_spec.rb b/spec/ruby/core/io/each_codepoint_spec.rb
index cddc6b4662..07a4037c8a 100644
--- a/spec/ruby/core/io/each_codepoint_spec.rb
+++ b/spec/ruby/core/io/each_codepoint_spec.rb
@@ -4,7 +4,7 @@ require_relative 'shared/codepoints'
# See redmine #1667
describe "IO#each_codepoint" do
- it_behaves_like :io_codepoints, :codepoints
+ it_behaves_like :io_codepoints, :each_codepoint
end
describe "IO#each_codepoint" do
diff --git a/spec/ruby/core/io/lines_spec.rb b/spec/ruby/core/io/lines_spec.rb
index a8b8023a2a..dcf5825259 100644
--- a/spec/ruby/core/io/lines_spec.rb
+++ b/spec/ruby/core/io/lines_spec.rb
@@ -2,41 +2,43 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
-describe "IO#lines" do
- before :each do
- @io = IOSpecs.io_fixture "lines.txt"
- end
-
- after :each do
- @io.close if @io
- end
+ruby_version_is ''...'2.8' do
+ describe "IO#lines" do
+ before :each do
+ @io = IOSpecs.io_fixture "lines.txt"
+ end
- it "returns an Enumerator" do
- @io.lines.should be_an_instance_of(Enumerator)
- end
+ after :each do
+ @io.close if @io
+ end
- describe "when no block is given" do
it "returns an Enumerator" do
@io.lines.should be_an_instance_of(Enumerator)
end
- describe "returned Enumerator" do
- describe "size" do
- it "should return nil" do
- @io.lines.size.should == nil
+ describe "when no block is given" do
+ it "returns an Enumerator" do
+ @io.lines.should be_an_instance_of(Enumerator)
+ end
+
+ describe "returned Enumerator" do
+ describe "size" do
+ it "should return nil" do
+ @io.lines.size.should == nil
+ end
end
end
end
- end
- it "returns a line when accessed" do
- enum = @io.lines
- enum.first.should == IOSpecs.lines[0]
- end
+ it "returns a line when accessed" do
+ enum = @io.lines
+ enum.first.should == IOSpecs.lines[0]
+ end
- it "yields each line to the passed block" do
- ScratchPad.record []
- @io.lines { |s| ScratchPad << s }
- ScratchPad.recorded.should == IOSpecs.lines
+ it "yields each line to the passed block" do
+ ScratchPad.record []
+ @io.lines { |s| ScratchPad << s }
+ ScratchPad.recorded.should == IOSpecs.lines
+ end
end
end
diff --git a/spec/ruby/library/stringio/bytes_spec.rb b/spec/ruby/library/stringio/bytes_spec.rb
index 692fba997f..bf0d27615e 100644
--- a/spec/ruby/library/stringio/bytes_spec.rb
+++ b/spec/ruby/library/stringio/bytes_spec.rb
@@ -2,10 +2,12 @@ require_relative '../../spec_helper'
require 'stringio'
require_relative 'shared/each_byte'
-describe "StringIO#bytes" do
- it_behaves_like :stringio_each_byte, :bytes
-end
+ruby_version_is ''...'2.8' do
+ describe "StringIO#bytes" do
+ it_behaves_like :stringio_each_byte, :bytes
+ end
-describe "StringIO#bytes when self is not readable" do
- it_behaves_like :stringio_each_byte_not_readable, :bytes
+ describe "StringIO#bytes when self is not readable" do
+ it_behaves_like :stringio_each_byte_not_readable, :bytes
+ end
end
diff --git a/spec/ruby/library/stringio/chars_spec.rb b/spec/ruby/library/stringio/chars_spec.rb
index 7dc55d4b37..e3879c2cff 100644
--- a/spec/ruby/library/stringio/chars_spec.rb
+++ b/spec/ruby/library/stringio/chars_spec.rb
@@ -2,10 +2,12 @@ require_relative '../../spec_helper'
require 'stringio'
require_relative 'shared/each_char'
-describe "StringIO#chars" do
- it_behaves_like :stringio_each_char, :chars
-end
+ruby_version_is ''...'2.8' do
+ describe "StringIO#chars" do
+ it_behaves_like :stringio_each_char, :chars
+ end
-describe "StringIO#chars when self is not readable" do
- it_behaves_like :stringio_each_char_not_readable, :chars
+ describe "StringIO#chars when self is not readable" do
+ it_behaves_like :stringio_each_char_not_readable, :chars
+ end
end
diff --git a/spec/ruby/library/stringio/codepoints_spec.rb b/spec/ruby/library/stringio/codepoints_spec.rb
index cc2e5d1b5d..6ca395c964 100644
--- a/spec/ruby/library/stringio/codepoints_spec.rb
+++ b/spec/ruby/library/stringio/codepoints_spec.rb
@@ -3,7 +3,10 @@ require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/codepoints'
-# See redmine #1667
-describe "StringIO#codepoints" do
- it_behaves_like :stringio_codepoints, :codepoints
+ruby_version_is ''...'2.8' do
+
+ # See redmine #1667
+ describe "StringIO#codepoints" do
+ it_behaves_like :stringio_codepoints, :codepoints
+ end
end
diff --git a/spec/ruby/library/stringio/each_char_spec.rb b/spec/ruby/library/stringio/each_char_spec.rb
index 7305162ee6..14b2f09a17 100644
--- a/spec/ruby/library/stringio/each_char_spec.rb
+++ b/spec/ruby/library/stringio/each_char_spec.rb
@@ -7,5 +7,5 @@ describe "StringIO#each_char" do
end
describe "StringIO#each_char when self is not readable" do
- it_behaves_like :stringio_each_char_not_readable, :chars
+ it_behaves_like :stringio_each_char_not_readable, :each_char
end
diff --git a/spec/ruby/library/stringio/each_codepoint_spec.rb b/spec/ruby/library/stringio/each_codepoint_spec.rb
index 85aa34d9d8..f18de22aad 100644
--- a/spec/ruby/library/stringio/each_codepoint_spec.rb
+++ b/spec/ruby/library/stringio/each_codepoint_spec.rb
@@ -5,5 +5,5 @@ require_relative 'shared/codepoints'
# See redmine #1667
describe "StringIO#each_codepoint" do
- it_behaves_like :stringio_codepoints, :codepoints
+ it_behaves_like :stringio_codepoints, :each_codepoint
end
diff --git a/spec/ruby/library/stringio/lines_spec.rb b/spec/ruby/library/stringio/lines_spec.rb
index d9dd26c2e2..0a2ab0d817 100644
--- a/spec/ruby/library/stringio/lines_spec.rb
+++ b/spec/ruby/library/stringio/lines_spec.rb
@@ -2,18 +2,20 @@ require_relative '../../spec_helper'
require 'stringio'
require_relative 'shared/each'
-describe "StringIO#lines when passed a separator" do
- it_behaves_like :stringio_each_separator, :lines
-end
+ruby_version_is ''...'2.8' do
+ describe "StringIO#lines when passed a separator" do
+ it_behaves_like :stringio_each_separator, :lines
+ end
-describe "StringIO#lines when passed no arguments" do
- it_behaves_like :stringio_each_no_arguments, :lines
-end
+ describe "StringIO#lines when passed no arguments" do
+ it_behaves_like :stringio_each_no_arguments, :lines
+ end
-describe "StringIO#lines when self is not readable" do
- it_behaves_like :stringio_each_not_readable, :lines
-end
+ describe "StringIO#lines when self is not readable" do
+ it_behaves_like :stringio_each_not_readable, :lines
+ end
-describe "StringIO#lines when passed chomp" do
- it_behaves_like :stringio_each_chomp, :lines
+ describe "StringIO#lines when passed chomp" do
+ it_behaves_like :stringio_each_chomp, :lines
+ end
end