diff options
Diffstat (limited to 'spec/ruby/library/zlib/gzipfile')
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/close_spec.rb | 22 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/closed_spec.rb | 17 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/comment_spec.rb | 27 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/crc_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/finish_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/level_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/mtime_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/orig_name_spec.rb | 27 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/os_code_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/sync_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/to_io_spec.rb | 1 | ||||
-rw-r--r-- | spec/ruby/library/zlib/gzipfile/wrap_spec.rb | 1 |
12 files changed, 101 insertions, 0 deletions
diff --git a/spec/ruby/library/zlib/gzipfile/close_spec.rb b/spec/ruby/library/zlib/gzipfile/close_spec.rb new file mode 100644 index 0000000000..9486d6b9ec --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/close_spec.rb @@ -0,0 +1,22 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'stringio' +require 'zlib' + +describe "Zlib::GzipFile#close" do + it "finishes the stream and closes the io" do + io = StringIO.new "".b + Zlib::GzipWriter.wrap io do |gzio| + gzio.close + + gzio.closed?.should == true + + lambda { gzio.orig_name }.should \ + raise_error(Zlib::GzipFile::Error, 'closed gzip stream') + lambda { gzio.comment }.should \ + raise_error(Zlib::GzipFile::Error, 'closed gzip stream') + end + + io.string[10..-1].should == ([3] + Array.new(9,0)).pack('C*') + end +end + diff --git a/spec/ruby/library/zlib/gzipfile/closed_spec.rb b/spec/ruby/library/zlib/gzipfile/closed_spec.rb new file mode 100644 index 0000000000..69785bc41c --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/closed_spec.rb @@ -0,0 +1,17 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'stringio' +require 'zlib' + +describe "Zlib::GzipFile#closed?" do + it "returns the closed status" do + io = StringIO.new + Zlib::GzipWriter.wrap io do |gzio| + gzio.closed?.should == false + + gzio.close + + gzio.closed?.should == true + end + end +end + diff --git a/spec/ruby/library/zlib/gzipfile/comment_spec.rb b/spec/ruby/library/zlib/gzipfile/comment_spec.rb new file mode 100644 index 0000000000..638e85a4a7 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/comment_spec.rb @@ -0,0 +1,27 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'stringio' +require 'zlib' + +describe "Zlib::GzipFile#comment" do + before :each do + @io = StringIO.new + end + + it "returns the name" do + Zlib::GzipWriter.wrap @io do |gzio| + gzio.comment = 'name' + + gzio.comment.should == 'name' + end + end + + it "raises an error on a closed stream" do + Zlib::GzipWriter.wrap @io do |gzio| + gzio.close + + lambda { gzio.comment }.should \ + raise_error(Zlib::GzipFile::Error, 'closed gzip stream') + end + end +end + diff --git a/spec/ruby/library/zlib/gzipfile/crc_spec.rb b/spec/ruby/library/zlib/gzipfile/crc_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/crc_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/finish_spec.rb b/spec/ruby/library/zlib/gzipfile/finish_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/finish_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/level_spec.rb b/spec/ruby/library/zlib/gzipfile/level_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/level_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/mtime_spec.rb b/spec/ruby/library/zlib/gzipfile/mtime_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/mtime_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb new file mode 100644 index 0000000000..42a3b2f376 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb @@ -0,0 +1,27 @@ +require File.expand_path('../../../../spec_helper', __FILE__) +require 'stringio' +require 'zlib' + +describe "Zlib::GzipFile#orig_name" do + before :each do + @io = StringIO.new + end + + it "returns the name" do + Zlib::GzipWriter.wrap @io do |gzio| + gzio.orig_name = 'name' + + gzio.orig_name.should == 'name' + end + end + + it "raises an error on a closed stream" do + Zlib::GzipWriter.wrap @io do |gzio| + gzio.close + + lambda { gzio.orig_name }.should \ + raise_error(Zlib::GzipFile::Error, 'closed gzip stream') + end + end +end + diff --git a/spec/ruby/library/zlib/gzipfile/os_code_spec.rb b/spec/ruby/library/zlib/gzipfile/os_code_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/os_code_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/sync_spec.rb b/spec/ruby/library/zlib/gzipfile/sync_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/sync_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/to_io_spec.rb b/spec/ruby/library/zlib/gzipfile/to_io_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/to_io_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) diff --git a/spec/ruby/library/zlib/gzipfile/wrap_spec.rb b/spec/ruby/library/zlib/gzipfile/wrap_spec.rb new file mode 100644 index 0000000000..6a4c1dadb4 --- /dev/null +++ b/spec/ruby/library/zlib/gzipfile/wrap_spec.rb @@ -0,0 +1 @@ +require File.expand_path('../../../../spec_helper', __FILE__) |