зеркало из https://github.com/github/ruby.git
* lib/rubygems.rb: Return BINARY strings from Gem.gzip and Gem.gunzip.
Fixes intermittent test failures. RubyGems issue #450 by Jeremey Kemper. * test/rubygems/test_gem.rb: Test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d1691db91e
Коммит
7266d24aa0
|
@ -1,3 +1,10 @@
|
|||
Wed Feb 13 06:05:52 2013 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rubygems.rb: Return BINARY strings from Gem.gzip and Gem.gunzip.
|
||||
Fixes intermittent test failures. RubyGems issue #450 by Jeremey
|
||||
Kemper.
|
||||
* test/rubygems/test_gem.rb: Test for the above.
|
||||
|
||||
Wed Feb 13 05:49:21 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/extconf.rb: test functions just after struct members.
|
||||
|
|
|
@ -475,7 +475,9 @@ module Gem
|
|||
require 'zlib'
|
||||
data = StringIO.new data
|
||||
|
||||
Zlib::GzipReader.new(data).read
|
||||
unzipped = Zlib::GzipReader.new(data).read
|
||||
unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
|
||||
unzipped
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -486,6 +488,7 @@ module Gem
|
|||
require 'stringio'
|
||||
require 'zlib'
|
||||
zipped = StringIO.new
|
||||
zipped.set_encoding Encoding::BINARY if Object.const_defined? :Encoding
|
||||
|
||||
Zlib::GzipWriter.wrap zipped do |io| io.write data end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче