Fix Requirement equality
This commit is contained in:
parent
33dfc8e8b8
commit
9dfc5e39e8
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user