[Rubygems-developers] [patch] fix cvs unit testsuite
Dick Davies
rasputnik at hellooperator.net
Tue Apr 20 00:31:28 EDT 2004
I was getting a failure in this weekends CVS,
=======================
Loaded suite -e
Started
............F...............................................................
Finished in 1.396762 seconds.
1) Failure:
test_garbled_gem_throws_format_exception(TestFormat) [./test/test_format.rb:21]:
<Gem::FormatException> exception expected but was
Class: <Zlib::DataError>
Message: <"unknown compression method">
---Backtrace---
./lib/rubygems/format.rb:141:in `inflate'
./lib/rubygems/format.rb:141:in `read_files_from_gem'
./lib/rubygems/format.rb:136:in `each'
./lib/rubygems/format.rb:136:in `read_files_from_gem'
./lib/rubygems/format.rb:57:in `from_io'
./test/test_format.rb:23:in `test_garbled_gem_throws_format_exception'
./test/test_format.rb:21:in `assert_raise'
./test/test_format.rb:21:in `test_garbled_gem_throws_format_exception'
---------------
76 tests, 91 assertions, 1 failures, 0 errors
rake aborted!
Command Failed: [ruby -Ilib -rscripts/runtest -e 'run_tests("test/test*.rb", true)']
./Rakefile:13
=======================
This looks like zlib crying at having to read an entry backwards. Fixing that gave
a similar error from syck where YAML::load returned false, raher than a record.
The patch below makes the suite greenlight again.
Is this due to me running latest CVS of ruby itself?
<patch follows>
0rasputin at lb:rubygems$ cvs diff -u lib/rubygems/format.rb
Index: lib/rubygems/format.rb
===================================================================
RCS file: /var/cvs/rubygems/rubygems/lib/rubygems/format.rb,v
retrieving revision 1.3
diff -u -r1.3 format.rb
--- lib/rubygems/format.rb 1 Apr 2004 00:13:20 -0000 1.3
+++ lib/rubygems/format.rb 19 Apr 2004 22:48:23 -0000
@@ -127,12 +127,14 @@
def self.read_files_from_gem(gem_file)
require 'zlib'
require 'yaml'
+ errstr = "Error reading files from gem"
header_yaml = ''
begin
self.read_until_dashes(gem_file) do |line|
header_yaml << line
end
header = YAML.load(header_yaml)
+ raise FormatException.new(errstr) unless header
header.each do |entry|
file_data = ''
self.read_until_dashes(gem_file) do |line|
@@ -140,8 +142,8 @@
end
yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
end
- rescue Exception => e
- raise FormatException.new("Error reading files from gem")
+ rescue Exception,Zlib::DataError => e
+ raise FormatException.new(errstr)
end
end
end
--
Entropy isn't what it used to be.
Rasputin :: Jack of All Trades - Master of Nuns
More information about the Rubygems-developers
mailing list