aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index fdeef699d4..bf77009ca6 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'rubygems/test_case'
require 'rubygems'
require 'rubygems/installer'
@@ -1237,6 +1238,33 @@ class TestGem < Gem::TestCase
end
end
+ def test_self_gunzip
+ input = "\x1F\x8B\b\0\xED\xA3\x1AQ\0\x03\xCBH" +
+ "\xCD\xC9\xC9\a\0\x86\xA6\x106\x05\0\0\0"
+
+ output = Gem.gunzip input
+
+ assert_equal 'hello', output
+
+ return unless Object.const_defined? :Encoding
+
+ assert_equal Encoding::BINARY, output.encoding
+ end
+
+ def test_self_gzip
+ input = 'hello'
+
+ output = Gem.gzip input
+
+ zipped = StringIO.new output
+
+ assert_equal 'hello', Zlib::GzipReader.new(zipped).read
+
+ return unless Object.const_defined? :Encoding
+
+ assert_equal Encoding::BINARY, output.encoding
+ end
+
if Gem.win_platform? && '1.9' > RUBY_VERSION
# Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
def test_self_user_home_userprofile