From 760c083c0c0c9934e4118b4669c8c8dfd0a3587d Mon Sep 17 00:00:00 2001 From: Max Howell Date: Mon, 10 Aug 2009 16:48:30 +0100 Subject: Refactor Large refactor to Formula, mostly improving reliability and error handling but also layout and readability. General improvements so testing can be more complete. Patches are automatically downloaded and applied for Formula that return a list of urls from Formula::patches. Split out the brew command logic to facilitate testing. Facility from Adam Vandenberg to allow selective cleaning of files, added because Python doesn't work when stripped. --- Library/Homebrew/unittest.rb | 60 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'Library/Homebrew/unittest.rb') diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 878b05ab9..1bee7b3a6 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -1,9 +1,8 @@ #!/usr/bin/ruby $:.unshift File.dirname(__FILE__) +require 'pathname+yeast' require 'formula' require 'keg' -require 'pathname+yeast' -require 'stringio' require 'utils' # these are defined in env.rb usually, but we don't want to break our actual @@ -17,6 +16,7 @@ HOMEBREW_CELLAR.mkpath raise "HOMEBREW_CELLAR couldn't be created!" unless HOMEBREW_CELLAR.directory? at_exit { HOMEBREW_PREFIX.parent.rmtree } require 'test/unit' # must be after at_exit +require 'ARGV+yeast' # needs to be after test/unit to avoid conflict with OptionsParser class MockFormula #{path}` - assert_not_nil Formula.create(FOOBAR) + 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_nil f.name + assert_raises(RuntimeError) { f.prefix } + nostdout { assert_raises(ExecutionError) { f.brew } } + end end -- cgit v1.2.3