Commit 1420ef01 authored by David Suárez's avatar David Suárez

Fix hash function collision

parent fb3f1820
Description: Fix hash function collision
It seems that the hash function defined in the tests sources, collides with
the hash function provided by the library.
Bug-Debian: http://bugs.debian.org/720249
Author: David Suárez <david.sephirot@gmail.com>
Last-Update: 2013-12-04
--- ruby-backports-3.3.5.orig/test/_backport_guards_test.rb
+++ ruby-backports-3.3.5/test/_backport_guards_test.rb
@@ -35,14 +35,14 @@ class AAA_TestBackportGuards < Test::Uni
EXCLUDE.map!(&:to_sym) if instance_methods.first.is_a?(Symbol)
# For some very strange reason, Hash[kvp.flatten] doesn't always work in 1.8.6??
- def hash(key_value_pairs)
+ def own_hash(key_value_pairs)
h = {}
key_value_pairs.each{|k,v| h[k] = v}
h
end
def class_signature(klass)
- hash(
+ own_hash(
(klass.instance_methods - EXCLUDE).map{|m| [m, klass.instance_method(m)] } +
(klass.methods - EXCLUDE).map{|m| [".#{m}", klass.method(m) ]}
)
@@ -62,7 +62,7 @@ class AAA_TestBackportGuards < Test::Uni
end
def digest
- hash(
+ own_hash(
CLASSES.map { |klass| [klass, class_signature(klass)] }
)
end
fix-collision-with-hash-function
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment