aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-04-10 12:02:35 -0500
committerJack Nagel2013-04-10 12:02:35 -0500
commiteadb0f60a847feeb5c5001f2bebcb0b030631e10 (patch)
treea1cfffd041dabc315383f7fb7f25c6e3bfb682be /Library
parent136aa4c6f45ca7f4cb1c691ffb5ccb53f1eef165 (diff)
downloadbrew-eadb0f60a847feeb5c5001f2bebcb0b030631e10.tar.bz2
Move formula equality tests out of test_bucket
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_bucket.rb12
-rw-r--r--Library/Homebrew/test/test_formula.rb20
-rw-r--r--Library/Homebrew/test/testball.rb4
3 files changed, 22 insertions, 14 deletions
diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb
index efbc0cdbb..96d2177a9 100644
--- a/Library/Homebrew/test/test_bucket.rb
+++ b/Library/Homebrew/test/test_bucket.rb
@@ -152,16 +152,4 @@ class BeerTasting < Test::Unit::TestCase
assert_equal 'foo-0.1', foo1.stem
assert_version_equal '0.1', foo1.version
end
-
- def test_formula_equality
- f = Class.new(Formula) do
- url 'http://example.com/test-0.1.tgz'
- end.new('test')
- g = Struct.new(:name).new('test')
-
- assert f == f
- assert f == g
- assert f.eql? f
- assert !f.eql?(g)
- end
end
diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb
index bdeb398d8..44d7b9bec 100644
--- a/Library/Homebrew/test/test_formula.rb
+++ b/Library/Homebrew/test/test_formula.rb
@@ -30,6 +30,26 @@ class FormulaTests < Test::Unit::TestCase
assert f.installed?
end
+ def test_equality
+ x = TestBall.new
+ y = TestBall.new
+ assert x == y
+ assert y == x
+ assert x.eql?(y)
+ assert y.eql?(x)
+ assert x.hash == y.hash
+ end
+
+ def test_inequality
+ x = TestBall.new("foo")
+ y = TestBall.new("bar")
+ assert x != y
+ assert y != x
+ assert x.hash != y.hash
+ assert !x.eql?(y)
+ assert !y.eql?(x)
+ end
+
def test_class_naming
assert_equal 'ShellFm', Formula.class_s('shell.fm')
assert_equal 'Fooxx', Formula.class_s('foo++')
diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb
index b18fe3e68..5f8bc08c2 100644
--- a/Library/Homebrew/test/testball.rb
+++ b/Library/Homebrew/test/testball.rb
@@ -1,14 +1,14 @@
require 'formula'
class TestBall < Formula
- def initialize(*)
+ def initialize(name="test_ball")
@homepage = 'http://example.com/'
self.class.instance_eval do
@stable ||= SoftwareSpec.new
@stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
@stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5"
end
- super "testball"
+ super
end
def install
prefix.install "bin"