diff options
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_bucket.rb | 41 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 55 | ||||
| -rwxr-xr-x | Library/Homebrew/test/tests | 2 |
3 files changed, 56 insertions, 42 deletions
diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb index 9f5ebdb09..4e623e6e9 100644 --- a/Library/Homebrew/test/test_bucket.rb +++ b/Library/Homebrew/test/test_bucket.rb @@ -15,11 +15,6 @@ class MockFormula <Formula end end -class MostlyAbstractFormula <Formula - @url='' - @homepage = 'http://example.com/' -end - class TestZip <Formula def initialize zip=HOMEBREW_CACHE.parent+'test-0.1.zip' @@ -30,14 +25,6 @@ class TestZip <Formula end end -class TestBallOverrideBrew <Formula - def initialize - super "foo" - end - def brew - end -end - # All other tests so far -- feel free to break them out into # separate TestCase classes. @@ -52,15 +39,6 @@ class BeerTasting < Test::Unit::TestCase end end - def test_prefix - nostdout do - TestBall.new.brew do |f| - assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s - assert_kind_of Pathname, f.prefix - end - end - end - FOOBAR='foo-bar' def test_formula_funcs classname=Formula.class_s(FOOBAR) @@ -87,17 +65,6 @@ class BeerTasting < Test::Unit::TestCase assert_not_nil Formula.factory(FOOBAR) end - def test_cant_override_brew - assert_raises(RuntimeError) { TestBallOverrideBrew.new } - end - - def test_abstract_formula - f=MostlyAbstractFormula.new - assert_equal '__UNKNOWN__', f.name - assert_raises(RuntimeError) { f.prefix } - nostdout { assert_raises(RuntimeError) { f.brew } } - end - def test_zip nostdout { assert_nothing_raised { TestZip.new.brew {} } } end @@ -209,14 +176,6 @@ class BeerTasting < Test::Unit::TestCase assert_equal '0.1', foo1.version end - def test_class_naming - assert_equal 'ShellFm', Formula.class_s('shell.fm') - assert_equal 'Fooxx', Formula.class_s('foo++') - assert_equal 'SLang', Formula.class_s('s-lang') - assert_equal 'PkgConfig', Formula.class_s('pkg-config') - assert_equal 'FooBar', Formula.class_s('foo_bar') - end - def test_ENV_options require 'extend/ENV' ENV.extend(HomebrewEnvExtension) diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb new file mode 100644 index 000000000..aa545f6d4 --- /dev/null +++ b/Library/Homebrew/test/test_formula.rb @@ -0,0 +1,55 @@ +require 'testing_env' + +require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser +ARGV.extend(HomebrewArgvExtension) + +require 'test/testball' +require 'utils' +require 'brew.h' + + +class MostlyAbstractFormula <Formula + @url='' + @homepage = 'http://example.com/' +end + +class TestBallOverrideBrew <Formula + def initialize + super "foo" + end + def brew + end +end + + +class FormulaTests < Test::Unit::TestCase + + def test_prefix + nostdout do + TestBall.new.brew do |f| + assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s + assert_kind_of Pathname, f.prefix + end + end + end + + def test_class_naming + assert_equal 'ShellFm', Formula.class_s('shell.fm') + assert_equal 'Fooxx', Formula.class_s('foo++') + assert_equal 'SLang', Formula.class_s('s-lang') + assert_equal 'PkgConfig', Formula.class_s('pkg-config') + assert_equal 'FooBar', Formula.class_s('foo_bar') + end + + def test_cant_override_brew + assert_raises(RuntimeError) { TestBallOverrideBrew.new } + end + + def test_abstract_formula + f=MostlyAbstractFormula.new + assert_equal '__UNKNOWN__', f.name + assert_raises(RuntimeError) { f.prefix } + nostdout { assert_raises(RuntimeError) { f.brew } } + end + +end diff --git a/Library/Homebrew/test/tests b/Library/Homebrew/test/tests index d439f17d1..41e08a6ba 100755 --- a/Library/Homebrew/test/tests +++ b/Library/Homebrew/test/tests @@ -12,7 +12,7 @@ # Feel free to split out test_bucket ruby test_bucket.rb $* - +ruby test_formula.rb $* ruby test_versions.rb $* ruby test_checksums.rb $* ruby test_inreplace.rb $* |
