Fix Requirement equality

This commit is contained in:
Jack Nagel 2014-11-12 17:35:16 -06:00
parent 33dfc8e8b8
commit 9dfc5e39e8
2 changed files with 4 additions and 1 deletions

View File

@ -75,9 +75,10 @@ class Requirement
self.class.env_proc
end
def eql?(other)
def ==(other)
instance_of?(other.class) && name == other.name && tags == other.tags
end
alias_method :eql?, :==
def hash
name.hash ^ tags.hash

View File

@ -129,12 +129,14 @@ class RequirementTests < Homebrew::TestCase
def test_eql
a, b = Requirement.new, Requirement.new
assert_equal a, b
assert_eql a, b
assert_equal a.hash, b.hash
end
def test_not_eql
a, b = Requirement.new([:optional]), Requirement.new
refute_equal a, b
refute_eql a, b
refute_equal a.hash, b.hash
end