diff options
Diffstat (limited to 'spec/ruby/library/zlib/inflate')
| -rw-r--r-- | spec/ruby/library/zlib/inflate/append_spec.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/finish_spec.rb | 3 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/inflate_spec.rb | 21 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/new_spec.rb | 1 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/set_dictionary_spec.rb | 5 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/sync_point_spec.rb | 1 | ||||
| -rw-r--r-- | spec/ruby/library/zlib/inflate/sync_spec.rb | 1 |
7 files changed, 20 insertions, 16 deletions
diff --git a/spec/ruby/library/zlib/inflate/append_spec.rb b/spec/ruby/library/zlib/inflate/append_spec.rb index a768a766a2..a4c791e31e 100644 --- a/spec/ruby/library/zlib/inflate/append_spec.rb +++ b/spec/ruby/library/zlib/inflate/append_spec.rb @@ -1,4 +1,4 @@ -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' require 'zlib' describe "Zlib::Inflate#<<" do @@ -41,7 +41,7 @@ describe "Zlib::Inflate#<<" do it "properly handles incomplete data" do # add bytes, one by one @foo_deflated[0, 5].each_byte { |d| @z << d.chr} - lambda { @z.finish }.should raise_error(Zlib::BufError) + -> { @z.finish }.should.raise(Zlib::BufError) end it "properly handles excessive data, byte-by-byte" do diff --git a/spec/ruby/library/zlib/inflate/finish_spec.rb b/spec/ruby/library/zlib/inflate/finish_spec.rb index f6e592fb6b..b7494e419c 100644 --- a/spec/ruby/library/zlib/inflate/finish_spec.rb +++ b/spec/ruby/library/zlib/inflate/finish_spec.rb @@ -1,3 +1,4 @@ +require_relative "../../../spec_helper" require 'zlib' describe "Zlib::Inflate#finish" do @@ -22,7 +23,7 @@ describe "Zlib::Inflate#finish" do end it "each chunk should have the same prefix" do - @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should be_true + @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should == true end end diff --git a/spec/ruby/library/zlib/inflate/inflate_spec.rb b/spec/ruby/library/zlib/inflate/inflate_spec.rb index 1fa16d9e98..92e52363db 100644 --- a/spec/ruby/library/zlib/inflate/inflate_spec.rb +++ b/spec/ruby/library/zlib/inflate/inflate_spec.rb @@ -1,5 +1,5 @@ require 'zlib' -require File.expand_path('../../../../spec_helper', __FILE__) +require_relative '../../../spec_helper' describe "Zlib::Inflate#inflate" do @@ -39,6 +39,13 @@ describe "Zlib::Inflate#inflate" do @inflator.finish.should == 'uncompressed_data' end + it "has a binary encoding" do + data = [120, 156, 99, 96, 128, 1, 0, 0, 10, 0, 1].pack('C*') + unzipped = @inflator.inflate data + @inflator.finish.encoding.should == Encoding::BINARY + unzipped.encoding.should == Encoding::BINARY + end + end describe "Zlib::Inflate.inflate" do @@ -65,7 +72,7 @@ describe "Zlib::Inflate.inflate" do data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*') z = Zlib::Inflate.new # add bytes, one by one - result = "" + result = +"" data.each_byte { |d| result << z.inflate(d.chr)} result << z.finish result.should == "foo" @@ -75,15 +82,15 @@ describe "Zlib::Inflate.inflate" do data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*')[0,5] z = Zlib::Inflate.new # add bytes, one by one, but not all - result = "" + result = +"" data.each_byte { |d| result << z.inflate(d.chr)} - lambda { result << z.finish }.should raise_error(Zlib::BufError) + -> { result << z.finish }.should.raise(Zlib::BufError) end it "properly handles excessive data, byte-by-byte" do main_data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*') data = main_data * 2 - result = "" + result = +"" z = Zlib::Inflate.new # add bytes, one by one @@ -98,7 +105,7 @@ describe "Zlib::Inflate.inflate" do it "properly handles excessive data, in one go" do main_data = [120, 156, 75, 203, 207, 7, 0, 2, 130, 1, 69].pack('C*') data = main_data * 2 - result = "" + result = +"" z = Zlib::Inflate.new result << z.inflate(data) @@ -131,7 +138,7 @@ describe "Zlib::Inflate#inflate" do end it "properly handles chunked data" do - @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should be_true + @chunks.all? { |chunk| chunk =~ /\A0+\z/ }.should == true end end diff --git a/spec/ruby/library/zlib/inflate/new_spec.rb b/spec/ruby/library/zlib/inflate/new_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/ruby/library/zlib/inflate/new_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb b/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb index 890815b8e6..375ee3c765 100644 --- a/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb +++ b/spec/ruby/library/zlib/inflate/set_dictionary_spec.rb @@ -1,5 +1,5 @@ -# -*- encoding: binary -*- -require File.expand_path('../../../../spec_helper', __FILE__) +# encoding: binary +require_relative '../../../spec_helper' require 'zlib' describe "Zlib::Inflate#set_dictionary" do @@ -18,4 +18,3 @@ describe "Zlib::Inflate#set_dictionary" do i.finish.should == 'abcdefghij' end end - diff --git a/spec/ruby/library/zlib/inflate/sync_point_spec.rb b/spec/ruby/library/zlib/inflate/sync_point_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/ruby/library/zlib/inflate/sync_point_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/inflate/sync_spec.rb b/spec/ruby/library/zlib/inflate/sync_spec.rb deleted file mode 100644 index 6a4c1dadb4..0000000000 --- a/spec/ruby/library/zlib/inflate/sync_spec.rb +++ /dev/null @@ -1 +0,0 @@ -require File.expand_path('../../../../spec_helper', __FILE__) |
