diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-20 20:18:52 +0000 |
commit | 1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch) | |
tree | a3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/library/zlib/gzipreader | |
parent | 75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff) |
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory.
[Misc #13792] [ruby-core:82287]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library/zlib/gzipreader')
21 files changed, 0 insertions, 813 deletions
diff --git a/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb deleted file mode 100644 index 6da9ac8323..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/each_byte_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#each_byte" do - - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - - @io = StringIO.new @zip - ScratchPad.clear - end - - it "calls the given block for each byte in the stream, passing the byte as an argument" do - gz = Zlib::GzipReader.new @io - - ScratchPad.record [] - gz.each_byte { |b| ScratchPad << b } - - ScratchPad.recorded.should == [49, 50, 51, 52, 53, 97, 98, 99, 100, 101] - end - - it "returns an enumerator, which yields each byte in the stream, when no block is passed" do - gz = Zlib::GzipReader.new @io - enum = gz.each_byte - - ScratchPad.record [] - while true - begin - ScratchPad << enum.next - rescue StopIteration - break - end - end - - ScratchPad.recorded.should == [49, 50, 51, 52, 53, 97, 98, 99, 100, 101] - end - - it "increments position before calling the block" do - gz = Zlib::GzipReader.new @io - - i = 1 - gz.each_byte do |ignore| - gz.pos.should == i - i += 1 - end - end - -end diff --git a/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb deleted file mode 100644 index 7ff116a258..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/each_line_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require File.expand_path('../shared/each', __FILE__) - -describe "GzipReader#each_line" do - it_behaves_like :gzipreader_each, :each_line -end diff --git a/spec/rubyspec/library/zlib/gzipreader/each_spec.rb b/spec/rubyspec/library/zlib/gzipreader/each_spec.rb deleted file mode 100644 index dd780e4083..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/each_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require File.expand_path('../shared/each', __FILE__) - -describe "GzipReader#each" do - it_behaves_like :gzipreader_each, :each -end diff --git a/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb b/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb deleted file mode 100644 index 446cbfec37..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/eof_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#eof?" do - - before :each do - @data = '{"a":1234}' - @zip = [31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 171, 86, 74, 84, 178, 50, - 52, 50, 54, 169, 5, 0, 196, 20, 118, 213, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - it "returns true when at EOF" do - gz = Zlib::GzipReader.new @io - gz.eof?.should be_false - gz.read - gz.eof?.should be_true - end - - it "returns true when at EOF with the exact length of uncompressed data" do - gz = Zlib::GzipReader.new @io - gz.eof?.should be_false - gz.read(10) - gz.eof?.should be_true - end - - it "returns true when at EOF with a length greater than the size of uncompressed data" do - gz = Zlib::GzipReader.new @io - gz.eof?.should be_false - gz.read(11) - gz.eof?.should be_true - end - - it "returns false when at EOF when there's data left in the buffer to read" do - gz = Zlib::GzipReader.new @io - gz.read(9) - gz.eof?.should be_false - gz.read - gz.eof?.should be_true - end - - # This is especially important for JRuby, since eof? there - # is more than just a simple accessor. - it "does not affect the reading data" do - gz = Zlib::GzipReader.new @io - 0.upto(9) do |i| - gz.eof?.should be_false - gz.read(1).should == @data[i, 1] - end - gz.eof?.should be_true - gz.read().should == "" - gz.eof?.should be_true - end - -end diff --git a/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb b/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb deleted file mode 100644 index a3c4aecf76..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/getc_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#getc" do - - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - it "returns the next character from the stream" do - gz = Zlib::GzipReader.new @io - gz.pos.should == 0 - - gz.getc.should == '1' - gz.getc.should == '2' - gz.getc.should == '3' - gz.getc.should == '4' - gz.getc.should == '5' - end - - it "increments position" do - gz = Zlib::GzipReader.new @io - ([email protected]).each do |i| - gz.pos.should == i - gz.getc - end - end - - it "returns nil at the end of the stream" do - gz = Zlib::GzipReader.new @io - gz.read - pos = gz.pos - gz.getc.should be_nil - gz.pos.should == pos - end - -end diff --git a/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb b/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb deleted file mode 100644 index d49adc2850..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/gets_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'zlib' -require 'stringio' - -describe 'GzipReader#gets' do - describe 'with "" separator' do - it 'reads paragraphs skipping newlines' do - # gz contains "\n\n\n\n\n123\n45\n\n\n\n\nabc\nde\n\n\n\n\n" - gz = Zlib::GzipReader.new( - StringIO.new( - [31, 139, 8, 0, 223, 152, 48, 89, 0, 3, 227, 226, 2, 2, 67, 35, - 99, 46, 19, 83, 16, 139, 43, 49, 41, 153, 43, 37, 21, 204, 4, 0, - 32, 119, 45, 184, 27, 0, 0, 0].pack('C*') - ) - ) - - gz.gets('').should == "123\n45\n\n" - gz.gets('').should == "abc\nde\n\n" - gz.eof?.should be_true - end - end -end diff --git a/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb b/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/lineno_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/new_spec.rb b/spec/rubyspec/library/zlib/gzipreader/new_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/new_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/open_spec.rb b/spec/rubyspec/library/zlib/gzipreader/open_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/open_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb b/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb deleted file mode 100644 index 66fbf388d8..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/pos_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#pos" do - - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - it "returns the position" do - gz = Zlib::GzipReader.new @io - - gz.pos.should == 0 - - gz.read 5 - gz.pos.should == 5 - - gz.read - gz.pos.should == @data.length - end - -end - diff --git a/spec/rubyspec/library/zlib/gzipreader/read_spec.rb b/spec/rubyspec/library/zlib/gzipreader/read_spec.rb deleted file mode 100644 index 337f507502..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/read_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#read" do - - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - it "with no arguments reads the entire content of a gzip file" do - gz = Zlib::GzipReader.new @io - gz.read.should == @data - end - - it "with nil length argument reads the entire content of a gzip file" do - gz = Zlib::GzipReader.new @io - gz.read(nil).should == @data - end - - it "reads the contents up to a certain size" do - gz = Zlib::GzipReader.new @io - gz.read(5).should == @data[0...5] - gz.read(5).should == @data[5...10] - end - - it "does not accept a negative length to read" do - gz = Zlib::GzipReader.new @io - lambda { - gz.read(-1) - }.should raise_error(ArgumentError) - end - - it "returns an empty string if a 0 length is given" do - gz = Zlib::GzipReader.new @io - gz.read(0).should == "" - end - - it "respects :external_encoding option" do - gz = Zlib::GzipReader.new(@io, external_encoding: 'UTF-8') - gz.read.encoding.should == Encoding::UTF_8 - - @io.rewind - gz = Zlib::GzipReader.new(@io, external_encoding: 'UTF-16LE') - gz.read.encoding.should == Encoding::UTF_16LE - end - - describe "at the end of data" do - it "returns empty string if length prameter is not specified or 0" do - gz = Zlib::GzipReader.new @io - gz.read # read till the end - gz.read(0).should == "" - gz.read().should == "" - gz.read(nil).should == "" - end - - it "returns nil if length prameter is positive" do - gz = Zlib::GzipReader.new @io - gz.read # read till the end - gz.read(1).should be_nil - gz.read(2**16).should be_nil - end - end - -end diff --git a/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/readchar_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/readline_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/readlines_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb b/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb deleted file mode 100644 index 2cdef54fd1..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/readpartial_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe 'GzipReader#readpartial' do - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new(@zip) - end - - it 'accepts nil buffer' do - gz = Zlib::GzipReader.new(@io) - gz.readpartial(5, nil).should == '12345' - end -end diff --git a/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb b/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb deleted file mode 100644 index 70bee3372d..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/rewind_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe "GzipReader#rewind" do - - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - ScratchPad.clear - end - - it "resets the position of the stream pointer" do - gz = Zlib::GzipReader.new @io - gz.read - gz.pos.should == @data.length - - gz.rewind - gz.pos.should == 0 - gz.lineno.should == 0 - end - - it "resets the position of the stream pointer to data previously read" do - gz = Zlib::GzipReader.new @io - first_read = gz.read - gz.rewind - first_read.should == gz.read - end - - it "invokes seek method on the associated IO object" do - # first, prepare the mock object: - (obj = mock("io")).should_receive(:get_io).any_number_of_times.and_return(@io) - def obj.read(args); get_io.read(args); end - def obj.seek(pos, whence = 0) - ScratchPad.record :seek - get_io.seek(pos, whence) - end - - gz = Zlib::GzipReader.new(obj) - gz.rewind() - - ScratchPad.recorded.should == :seek - gz.pos.should == 0 - gz.read.should == "12345abcde" - end -end diff --git a/spec/rubyspec/library/zlib/gzipreader/shared/each.rb b/spec/rubyspec/library/zlib/gzipreader/shared/each.rb deleted file mode 100644 index 47cd284b6a..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/shared/each.rb +++ /dev/null @@ -1,51 +0,0 @@ -require File.expand_path('../../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe :gzipreader_each, shared: true do - - before :each do - @data = "firstline\nsecondline\n\nforthline" - @zip = [31, 139, 8, 0, 244, 125, 128, 88, 2, 255, 75, 203, 44, 42, 46, 201, - 201, 204, 75, 229, 42, 78, 77, 206, 207, 75, 1, 51, 185, 210,242, - 139, 74, 50, 64, 76, 0, 180, 54, 61, 111, 31, 0, 0, 0].pack('C*') - - @io = StringIO.new @zip - @gzreader = Zlib::GzipReader.new @io - end - - after :each do - ScratchPad.clear - end - - it "calls the given block for each line in the stream, passing the line as an argument" do - ScratchPad.record [] - @gzreader.send(@method) { |b| ScratchPad << b } - - ScratchPad.recorded.should == ["firstline\n", "secondline\n", "\n", "forthline"] - end - - it "returns an enumerator, which yields each byte in the stream, when no block is passed" do - enum = @gzreader.send(@method) - - ScratchPad.record [] - while true - begin - ScratchPad << enum.next - rescue StopIteration - break - end - end - - ScratchPad.recorded.should == ["firstline\n", "secondline\n", "\n", "forthline"] - end - - it "increments position before calling the block" do - i = 0 - @gzreader.send(@method) do |line| - i += line.length - @gzreader.pos.should == i - end - end - -end diff --git a/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb b/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/tell_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb b/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb deleted file mode 100644 index 16f1c12272..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/ungetbyte_spec.rb +++ /dev/null @@ -1,122 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe 'GzipReader#ungetbyte' do - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - describe 'at the start of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io) - end - - describe 'with an integer' do - it 'prepends the byte to the stream' do - @gz.ungetbyte 0x21 - @gz.read.should == '!12345abcde' - end - - ruby_bug "#13616", ""..."2.6" do - it 'decrements pos' do - @gz.ungetbyte 0x21 - @gz.pos.should == -1 - end - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not prepend anything to the stream' do - @gz.ungetbyte nil - @gz.read.should == '12345abcde' - end - - it 'does not decrement pos' do - @gz.ungetbyte nil - @gz.pos.should == 0 - end - end - end - end - - describe 'in the middle of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io) - @gz.read 5 - end - - describe 'with an integer' do - it 'inserts the corresponding character into the stream' do - @gz.ungetbyte 0x21 - @gz.read.should == '!abcde' - end - - it 'decrements pos' do - @gz.ungetbyte 0x21 - @gz.pos.should == 4 - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not insert anything into the stream' do - @gz.ungetbyte nil - @gz.read.should == 'abcde' - end - - it 'does not decrement pos' do - @gz.ungetbyte nil - @gz.pos.should == 5 - end - end - end - end - - describe 'at the end of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io) - @gz.read - end - - describe 'with an integer' do - it 'appends the corresponding character to the stream' do - @gz.ungetbyte 0x21 - @gz.read.should == '!' - end - - it 'decrements pos' do - @gz.ungetbyte 0x21 - @gz.pos.should == 9 - end - - it 'makes eof? false' do - @gz.ungetbyte 0x21 - @gz.eof?.should be_false - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not append anything to the stream' do - @gz.ungetbyte nil - @gz.read.should == '' - end - - it 'does not decrement pos' do - @gz.ungetbyte nil - @gz.pos.should == 10 - end - - it 'does not make eof? false' do - @gz.ungetbyte nil - @gz.eof?.should be_true - end - end - end - end -end diff --git a/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb b/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb deleted file mode 100644 index 2d218e8d19..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/ungetc_spec.rb +++ /dev/null @@ -1,292 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) -require 'stringio' -require 'zlib' - -describe 'GzipReader#ungetc' do - before :each do - @data = '12345abcde' - @zip = [31, 139, 8, 0, 44, 220, 209, 71, 0, 3, 51, 52, 50, 54, 49, 77, - 76, 74, 78, 73, 5, 0, 157, 5, 0, 36, 10, 0, 0, 0].pack('C*') - @io = StringIO.new @zip - end - - describe 'at the start of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8) - end - - describe 'with a single-byte character' do - it 'prepends the character to the stream' do - @gz.ungetc 'x' - @gz.read.should == 'x12345abcde' - end - - ruby_bug "#13616", ""..."2.6" do - it 'decrements pos' do - @gz.ungetc 'x' - @gz.pos.should == -1 - end - end - end - - describe 'with a multi-byte character' do - it 'prepends the character to the stream' do - @gz.ungetc 'ŷ' - @gz.read.should == 'ŷ12345abcde' - end - - ruby_bug "#13616", ""..."2.6" do - it 'decrements pos' do - @gz.ungetc 'ŷ' - @gz.pos.should == -2 - end - end - end - - describe 'with a multi-character string' do - it 'prepends the characters to the stream' do - @gz.ungetc 'xŷž' - @gz.read.should == 'xŷž12345abcde' - end - - ruby_bug "#13616", ""..."2.6" do - it 'decrements pos' do - @gz.ungetc 'xŷž' - @gz.pos.should == -5 - end - end - end - - describe 'with an integer' do - it 'prepends the corresponding character to the stream' do - @gz.ungetc 0x21 - @gz.read.should == '!12345abcde' - end - - ruby_bug "#13616", ""..."2.6" do - it 'decrements pos' do - @gz.ungetc 0x21 - @gz.pos.should == -1 - end - end - end - - describe 'with an empty string' do - it 'does not prepend anything to the stream' do - @gz.ungetc '' - @gz.read.should == '12345abcde' - end - - it 'does not decrement pos' do - @gz.ungetc '' - @gz.pos.should == 0 - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not prepend anything to the stream' do - @gz.ungetc nil - @gz.read.should == '12345abcde' - end - - it 'does not decrement pos' do - @gz.ungetc nil - @gz.pos.should == 0 - end - end - end - end - - describe 'in the middle of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8) - @gz.read 5 - end - - describe 'with a single-byte character' do - it 'inserts the character into the stream' do - @gz.ungetc 'x' - @gz.read.should == 'xabcde' - end - - it 'decrements pos' do - @gz.ungetc 'x' - @gz.pos.should == 4 - end - end - - describe 'with a multi-byte character' do - it 'inserts the character into the stream' do - @gz.ungetc 'ŷ' - @gz.read.should == 'ŷabcde' - end - - it 'decrements pos' do - @gz.ungetc 'ŷ' - @gz.pos.should == 3 - end - end - - describe 'with a multi-character string' do - it 'inserts the characters into the stream' do - @gz.ungetc 'xŷž' - @gz.read.should == 'xŷžabcde' - end - - it 'decrements pos' do - @gz.ungetc 'xŷž' - @gz.pos.should == 0 - end - end - - describe 'with an integer' do - it 'inserts the corresponding character into the stream' do - @gz.ungetc 0x21 - @gz.read.should == '!abcde' - end - - it 'decrements pos' do - @gz.ungetc 0x21 - @gz.pos.should == 4 - end - end - - describe 'with an empty string' do - it 'does not insert anything into the stream' do - @gz.ungetc '' - @gz.read.should == 'abcde' - end - - it 'does not decrement pos' do - @gz.ungetc '' - @gz.pos.should == 5 - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not insert anything into the stream' do - @gz.ungetc nil - @gz.read.should == 'abcde' - end - - it 'does not decrement pos' do - @gz.ungetc nil - @gz.pos.should == 5 - end - end - end - end - - describe 'at the end of the stream' do - before :each do - @gz = Zlib::GzipReader.new(@io, external_encoding: Encoding::UTF_8) - @gz.read - end - - describe 'with a single-byte character' do - it 'appends the character to the stream' do - @gz.ungetc 'x' - @gz.read.should == 'x' - end - - it 'decrements pos' do - @gz.ungetc 'x' - @gz.pos.should == 9 - end - - it 'makes eof? false' do - @gz.ungetc 'x' - @gz.eof?.should be_false - end - end - - describe 'with a multi-byte character' do - it 'appends the character to the stream' do - @gz.ungetc 'ŷ' - @gz.read.should == 'ŷ' - end - - it 'decrements pos' do - @gz.ungetc 'ŷ' - @gz.pos.should == 8 - end - - it 'makes eof? false' do - @gz.ungetc 'ŷ' - @gz.eof?.should be_false - end - end - - describe 'with a multi-character string' do - it 'appends the characters to the stream' do - @gz.ungetc 'xŷž' - @gz.read.should == 'xŷž' - end - - it 'decrements pos' do - @gz.ungetc 'xŷž' - @gz.pos.should == 5 - end - - it 'makes eof? false' do - @gz.ungetc 'xŷž' - @gz.eof?.should be_false - end - end - - describe 'with an integer' do - it 'appends the corresponding character to the stream' do - @gz.ungetc 0x21 - @gz.read.should == '!' - end - - it 'decrements pos' do - @gz.ungetc 0x21 - @gz.pos.should == 9 - end - - it 'makes eof? false' do - @gz.ungetc 0x21 - @gz.eof?.should be_false - end - end - - describe 'with an empty string' do - it 'does not append anything to the stream' do - @gz.ungetc '' - @gz.read.should == '' - end - - it 'does not decrement pos' do - @gz.ungetc '' - @gz.pos.should == 10 - end - - it 'does not make eof? false' do - @gz.ungetc '' - @gz.eof?.should be_true - end - end - - quarantine! do # https://bugs.ruby-lang.org/issues/13675 - describe 'with nil' do - it 'does not append anything to the stream' do - @gz.ungetc nil - @gz.read.should == '' - end - - it 'does not decrement pos' do - @gz.ungetc nil - @gz.pos.should == 10 - end - - it 'does not make eof? false' do - @gz.ungetc nil - @gz.eof?.should be_true - end - end - end - end -end diff --git a/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb b/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/rubyspec/library/zlib/gzipreader/unused_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) |