Move formula equality tests out of test_bucket

This commit is contained in:
Jack Nagel 2013-04-10 12:02:35 -05:00
parent 136aa4c6f4
commit eadb0f60a8
3 changed files with 22 additions and 14 deletions

View File

@ -152,16 +152,4 @@ class BeerTasting < Test::Unit::TestCase
assert_equal 'foo-0.1', foo1.stem assert_equal 'foo-0.1', foo1.stem
assert_version_equal '0.1', foo1.version assert_version_equal '0.1', foo1.version
end 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 end

View File

@ -30,6 +30,26 @@ class FormulaTests < Test::Unit::TestCase
assert f.installed? assert f.installed?
end 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 def test_class_naming
assert_equal 'ShellFm', Formula.class_s('shell.fm') assert_equal 'ShellFm', Formula.class_s('shell.fm')
assert_equal 'Fooxx', Formula.class_s('foo++') assert_equal 'Fooxx', Formula.class_s('foo++')

View File

@ -1,14 +1,14 @@
require 'formula' require 'formula'
class TestBall < Formula class TestBall < Formula
def initialize(*) def initialize(name="test_ball")
@homepage = 'http://example.com/' @homepage = 'http://example.com/'
self.class.instance_eval do self.class.instance_eval do
@stable ||= SoftwareSpec.new @stable ||= SoftwareSpec.new
@stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz" @stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
@stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5" @stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5"
end end
super "testball" super
end end
def install def install
prefix.install "bin" prefix.install "bin"