Add tests for pouring bottle without Xcode
add testball_bottle formula for upcoming bottle unit testing, as well as bottles directory containing test bottle (and symlinks)
This commit is contained in:
parent
8793a68ee4
commit
f108d204f7
@ -0,0 +1 @@
|
|||||||
|
testball_bottle-0.1.yosemite.bottle.tar.gz
|
||||||
@ -0,0 +1 @@
|
|||||||
|
testball_bottle-0.1.yosemite.bottle.tar.gz
|
||||||
Binary file not shown.
78
Library/Homebrew/test/test_formula_installer_bottle.rb
Normal file
78
Library/Homebrew/test/test_formula_installer_bottle.rb
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
require "testing_env"
|
||||||
|
require "formula"
|
||||||
|
require "compat/formula_specialties"
|
||||||
|
require "formula_installer"
|
||||||
|
require "keg"
|
||||||
|
require "testball_bottle"
|
||||||
|
require "testball"
|
||||||
|
|
||||||
|
class InstallBottleTests < Homebrew::TestCase
|
||||||
|
def temporary_bottle_install(formula)
|
||||||
|
refute_predicate formula, :installed?
|
||||||
|
assert_predicate formula, :bottled?
|
||||||
|
assert_predicate formula, :pour_bottle?
|
||||||
|
|
||||||
|
installer = FormulaInstaller.new(formula)
|
||||||
|
|
||||||
|
shutup { installer.install }
|
||||||
|
|
||||||
|
keg = Keg.new(formula.prefix)
|
||||||
|
|
||||||
|
assert_predicate formula, :installed?
|
||||||
|
|
||||||
|
begin
|
||||||
|
yield formula
|
||||||
|
ensure
|
||||||
|
keg.unlink
|
||||||
|
keg.uninstall
|
||||||
|
formula.clear_cache
|
||||||
|
Dir["#{HOMEBREW_CACHE}/testball_bottle*"].each { |f| File.delete(f) }
|
||||||
|
# there will be log files when sandbox is enable.
|
||||||
|
formula.logs.rmtree if formula.logs.directory?
|
||||||
|
end
|
||||||
|
|
||||||
|
refute_predicate keg, :exist?
|
||||||
|
refute_predicate formula, :installed?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_a_basic_bottle_install
|
||||||
|
MacOS.stubs(:has_apple_developer_tools?).returns(false)
|
||||||
|
|
||||||
|
temporary_bottle_install(TestballBottle.new) do |f|
|
||||||
|
# Copied directly from test_formula_installer.rb as we expect
|
||||||
|
# the same behavior
|
||||||
|
|
||||||
|
# Test that things made it into the Keg
|
||||||
|
assert_predicate f.bin, :directory?
|
||||||
|
|
||||||
|
assert_predicate f.libexec, :directory?
|
||||||
|
|
||||||
|
refute_predicate f.prefix+"main.c", :exist?
|
||||||
|
|
||||||
|
# Test that things make it into the Cellar
|
||||||
|
keg = Keg.new f.prefix
|
||||||
|
keg.link
|
||||||
|
|
||||||
|
bin = HOMEBREW_PREFIX+"bin"
|
||||||
|
assert_predicate bin, :directory?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_build_tools_error
|
||||||
|
MacOS.stubs(:has_apple_developer_tools?).returns(false)
|
||||||
|
|
||||||
|
# Testball doesn't have a bottle block, so use it to test this behavior
|
||||||
|
formula = Testball.new
|
||||||
|
|
||||||
|
refute_predicate formula, :installed?
|
||||||
|
refute_predicate formula, :bottled?
|
||||||
|
|
||||||
|
installer = FormulaInstaller.new(formula)
|
||||||
|
|
||||||
|
assert_raises(BuildToolsError) do
|
||||||
|
installer.install
|
||||||
|
end
|
||||||
|
|
||||||
|
refute_predicate formula, :installed?
|
||||||
|
end
|
||||||
|
end
|
||||||
17
Library/Homebrew/test/testball_bottle.rb
Normal file
17
Library/Homebrew/test/testball_bottle.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
class TestballBottle < Formula
|
||||||
|
def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable)
|
||||||
|
self.class.instance_eval do
|
||||||
|
stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz"
|
||||||
|
stable.sha256 "1dfb13ce0f6143fe675b525fc9e168adb2215c5d5965c9f57306bb993170914f"
|
||||||
|
stable.bottle do
|
||||||
|
cellar :any_skip_relocation
|
||||||
|
root_url "file://#{File.expand_path("..", __FILE__)}/bottles"
|
||||||
|
sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :yosemite
|
||||||
|
sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :mavericks
|
||||||
|
sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => :mountain_lion
|
||||||
|
end
|
||||||
|
cxxstdlib_check :skip
|
||||||
|
end
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user