From f6743bbfd797cdc1904a2ecd3ae3def28d10b081 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 1 Sep 2009 12:05:26 +0100 Subject: Tests for hw.model and brew.h.rb --- Library/Homebrew/unittest.rb | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index f7f50e41b..07d853842 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -3,12 +3,15 @@ # support, and with no warranty, express or implied, as to its usefulness for # any purpose. -$:.unshift File.dirname(__FILE__) +ABS__FILE__=File.expand_path(__FILE__) + +$:.unshift File.dirname(ABS__FILE__) require 'pathname+yeast' require 'formula' require 'download_strategy' require 'keg' require 'utils' +require 'brew.h' # these are defined in bin/brew, but we don't want to break our actual # homebrew tree, and we do want to test everything :) @@ -17,9 +20,10 @@ HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" HOMEBREW_USER_AGENT="Homebrew" -HOMEBREW_CELLAR.mkpath -raise "HOMEBREW_CELLAR couldn't be created!" unless HOMEBREW_CELLAR.directory? +(HOMEBREW_PREFIX+'Library'+'Formula').mkpath +Dir.chdir HOMEBREW_PREFIX 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 @@ -37,7 +41,7 @@ end class TestBall