Fix Formula#<=> on trunk Ruby
Arguably this method shouldn't exist and sort_by(&:name) used instead.
This commit is contained in:
parent
618b894c3e
commit
b78308d2d5
@ -301,9 +301,12 @@ class Formula
|
||||
def hash
|
||||
name.hash
|
||||
end
|
||||
def <=> b
|
||||
name <=> b.name
|
||||
|
||||
def <=>(other)
|
||||
return unless Formula === other
|
||||
name <=> other.name
|
||||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
@ -139,6 +139,10 @@ class FormulaTests < Homebrew::TestCase
|
||||
refute_equal TestBall.new, Object.new
|
||||
end
|
||||
|
||||
def test_sort_operator
|
||||
assert_nil TestBall.new <=> Object.new
|
||||
end
|
||||
|
||||
def test_class_naming
|
||||
assert_equal 'ShellFm', Formulary.class_s('shell.fm')
|
||||
assert_equal 'Fooxx', Formulary.class_s('foo++')
|
||||
|
Loading…
x
Reference in New Issue
Block a user