brew/Library/Homebrew/test/test_formula_install.rb

68 lines
1.4 KiB
Ruby
Raw Normal View History

2010-02-18 11:40:59 -08:00
require 'testing_env'
require 'formula'
require 'test/testball'
2010-02-18 11:40:59 -08:00
require 'keg'
class InstallTests < Test::Unit::TestCase
def teardown
HOMEBREW_CACHE.rmtree
end
2010-02-18 11:40:59 -08:00
def temporary_install f
f.prefix.mkpath
keg = Keg.new(f.prefix)
2013-04-01 12:15:29 -05:00
shutup do
2010-02-18 11:40:59 -08:00
f.brew { f.install }
end
begin
yield
ensure
keg.unlink
keg.uninstall
end
2010-02-18 11:40:59 -08:00
assert !keg.exist?
assert !f.installed?
end
def test_a_basic_install
f=TestBall.new
2010-02-18 11:40:59 -08:00
assert !f.installed?
2010-02-18 11:40:59 -08:00
temporary_install f do
2010-02-18 11:40:59 -08:00
# Test that things made it into the Keg
assert f.bin.directory?
assert_equal 3, f.bin.children.length
libexec=f.prefix+'libexec'
assert libexec.directory?
assert_equal 1, libexec.children.length
assert !(f.prefix+'main.c').exist?
assert f.installed?
2010-02-18 11:40:59 -08:00
# Test that things make it into the Cellar
keg=Keg.new f.prefix
keg.link
assert_equal 3, HOMEBREW_PREFIX.children.length
assert((HOMEBREW_PREFIX+'bin').directory?)
2010-02-18 11:40:59 -08:00
assert_equal 3, (HOMEBREW_PREFIX+'bin').children.length
end
end
2010-02-18 11:40:59 -08:00
def test_script_install
f = Class.new(ScriptFileFormula) do
2014-06-12 18:14:48 -05:00
url "file://#{File.expand_path(__FILE__)}"
version "1"
def initialize
2014-06-12 18:14:48 -05:00
super "test_script_formula", Pathname.new(__FILE__).expand_path
end
end.new
2014-06-12 21:31:51 -05:00
temporary_install(f) { assert_equal 1, f.bin.children.length }
2010-02-18 11:40:59 -08:00
end
end