Use real repo to run tests
This commit is contained in:
parent
f9900a5dbf
commit
6278e08aec
@ -127,24 +127,12 @@ end
|
|||||||
class SuperenvTests < Homebrew::TestCase
|
class SuperenvTests < Homebrew::TestCase
|
||||||
include SharedEnvTests
|
include SharedEnvTests
|
||||||
|
|
||||||
attr_reader :env, :bin
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@env = {}.extend(Superenv)
|
@env = {}.extend(Superenv)
|
||||||
@bin = HOMEBREW_REPOSITORY/"Library/ENV/#{MacOS::Xcode.version}"
|
|
||||||
bin.mkpath
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_bin
|
|
||||||
assert_equal bin, Superenv.bin
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_initializes_deps
|
def test_initializes_deps
|
||||||
assert_equal [], env.deps
|
assert_equal [], @env.deps
|
||||||
assert_equal [], env.keg_only_deps
|
assert_equal [], @env.keg_only_deps
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
bin.rmtree
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -178,19 +178,7 @@ class FormulaTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_factory
|
def test_factory
|
||||||
name = 'foo-bar'
|
assert_kind_of Formula, Formulary.factory("tree")
|
||||||
path = HOMEBREW_PREFIX+"Library/Formula/#{name}.rb"
|
|
||||||
path.dirname.mkpath
|
|
||||||
File.open(path, 'w') do |f|
|
|
||||||
f << %{
|
|
||||||
class #{Formulary.class_s(name)} < Formula
|
|
||||||
url 'foo-1.0'
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
assert_kind_of Formula, Formulary.factory(name)
|
|
||||||
ensure
|
|
||||||
path.unlink
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_class_specs_are_always_initialized
|
def test_class_specs_are_always_initialized
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
# Require this file to build a testing environment.
|
# Require this file to build a testing environment.
|
||||||
|
|
||||||
$:.push(File.expand_path(__FILE__+'/../..'))
|
repo_root = Pathname.new File.expand_path("../../../..", __FILE__)
|
||||||
|
$: << repo_root.join("Library", "Homebrew").to_s
|
||||||
|
|
||||||
require 'extend/module'
|
require 'extend/module'
|
||||||
require 'extend/fileutils'
|
require 'extend/fileutils'
|
||||||
@ -19,8 +20,10 @@ at_exit { FileUtils.remove_entry(TEST_TMPDIR) }
|
|||||||
|
|
||||||
# Constants normally defined in global.rb
|
# Constants normally defined in global.rb
|
||||||
HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")
|
HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")
|
||||||
HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
|
HOMEBREW_REPOSITORY = repo_root
|
||||||
|
HOMEBREW_BREW_FILE = HOMEBREW_REPOSITORY+"bin"+"brew"
|
||||||
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
|
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
|
||||||
|
HOMEBREW_LIBRARY_PATH = HOMEBREW_LIBRARY+"Homebrew"
|
||||||
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
|
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
|
||||||
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+'formula_cache'
|
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+'formula_cache'
|
||||||
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+'cellar'
|
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+'cellar'
|
||||||
@ -48,8 +51,7 @@ MACOS_VERSION = ENV.fetch('MACOS_VERSION') { MACOS_FULL_VERSION[/10\.\d+/] }
|
|||||||
ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
|
ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
|
||||||
|
|
||||||
# Test environment setup
|
# Test environment setup
|
||||||
%w{ENV Formula}.each { |d| HOMEBREW_LIBRARY.join(d).mkpath }
|
%w{prefix cache formula_cache cellar logs}.each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
|
||||||
%w{cache formula_cache cellar logs}.each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
|
|
||||||
|
|
||||||
# Test fixtures and files can be found relative to this path
|
# Test fixtures and files can be found relative to this path
|
||||||
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
|
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user