tests: setup and teardown cleanups
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
d502742e6d
commit
84a4935bb5
@ -18,6 +18,10 @@ ARGV.extend ExtendArgvPlusYeast
|
|||||||
|
|
||||||
class ARGVTests < Test::Unit::TestCase
|
class ARGVTests < Test::Unit::TestCase
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
ARGV.reset
|
||||||
|
end
|
||||||
|
|
||||||
def test_ARGV
|
def test_ARGV
|
||||||
assert ARGV.named.empty?
|
assert ARGV.named.empty?
|
||||||
|
|
||||||
@ -31,7 +35,6 @@ class ARGVTests < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_switch?
|
def test_switch?
|
||||||
ARGV.reset
|
|
||||||
ARGV.unshift "-ns"
|
ARGV.unshift "-ns"
|
||||||
ARGV.unshift "-i"
|
ARGV.unshift "-i"
|
||||||
ARGV.unshift "--bar"
|
ARGV.unshift "--bar"
|
||||||
|
@ -171,6 +171,8 @@ class BeerTasting < Test::Unit::TestCase
|
|||||||
assert orig_abcd.exist?
|
assert orig_abcd.exist?
|
||||||
|
|
||||||
HOMEBREW_CACHE.chmod_R 0777
|
HOMEBREW_CACHE.chmod_R 0777
|
||||||
|
|
||||||
|
abcd.unlink # teardown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,17 +8,16 @@ ENV.extend(HomebrewEnvExtension)
|
|||||||
|
|
||||||
require 'test/testball'
|
require 'test/testball'
|
||||||
|
|
||||||
module CompilerTestsEnvExtension
|
|
||||||
def unset_use_cc
|
|
||||||
vars = %w{HOMEBREW_USE_CLANG HOMEBREW_USE_LLVM HOMEBREW_USE_GCC}
|
|
||||||
vars.each { |v| ENV.delete(v) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
ENV.extend(CompilerTestsEnvExtension)
|
|
||||||
|
|
||||||
class CompilerTests < Test::Unit::TestCase
|
class CompilerTests < Test::Unit::TestCase
|
||||||
|
def setup
|
||||||
|
%w{HOMEBREW_USE_CLANG HOMEBREW_USE_LLVM HOMEBREW_USE_GCC}.each { |v| ENV.delete(v) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def teardown
|
||||||
|
ENV.send MacOS.default_compiler
|
||||||
|
end
|
||||||
|
|
||||||
def test_llvm_failure
|
def test_llvm_failure
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestLLVMFailure.new
|
f = TestLLVMFailure.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -32,12 +31,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
when 0..210 then :gcc
|
when 0..210 then :gcc
|
||||||
else :clang
|
else :clang
|
||||||
end, ENV.compiler
|
end, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_all_compiler_failures
|
def test_all_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestAllCompilerFailures.new
|
f = TestAllCompilerFailures.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -48,12 +44,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
cs.select_compiler
|
cs.select_compiler
|
||||||
|
|
||||||
assert_equal MacOS.default_compiler, ENV.compiler
|
assert_equal MacOS.default_compiler, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_compiler_failures
|
def test_no_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestNoCompilerFailures.new
|
f = TestNoCompilerFailures.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -67,12 +60,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
cs.select_compiler
|
cs.select_compiler
|
||||||
|
|
||||||
assert_equal MacOS.default_compiler, ENV.compiler
|
assert_equal MacOS.default_compiler, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mixed_compiler_failures
|
def test_mixed_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestMixedCompilerFailures.new
|
f = TestMixedCompilerFailures.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -83,12 +73,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
cs.select_compiler
|
cs.select_compiler
|
||||||
|
|
||||||
assert_equal :llvm, ENV.compiler
|
assert_equal :llvm, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_more_mixed_compiler_failures
|
def test_more_mixed_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestMoreMixedCompilerFailures.new
|
f = TestMoreMixedCompilerFailures.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -99,12 +86,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
cs.select_compiler
|
cs.select_compiler
|
||||||
|
|
||||||
assert_equal :clang, ENV.compiler
|
assert_equal :clang, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_even_more_mixed_compiler_failures
|
def test_even_more_mixed_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestEvenMoreMixedCompilerFailures.new
|
f = TestEvenMoreMixedCompilerFailures.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -121,12 +105,9 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
when 0..210 then :gcc
|
when 0..210 then :gcc
|
||||||
else :clang
|
else :clang
|
||||||
end, ENV.compiler
|
end, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_block_with_no_build_compiler_failures
|
def test_block_with_no_build_compiler_failures
|
||||||
ENV.unset_use_cc
|
|
||||||
f = TestBlockWithoutBuildCompilerFailure.new
|
f = TestBlockWithoutBuildCompilerFailure.new
|
||||||
cs = CompilerSelector.new(f)
|
cs = CompilerSelector.new(f)
|
||||||
|
|
||||||
@ -137,7 +118,5 @@ class CompilerTests < Test::Unit::TestCase
|
|||||||
cs.select_compiler
|
cs.select_compiler
|
||||||
|
|
||||||
assert_equal MacOS.default_compiler, ENV.compiler
|
assert_equal MacOS.default_compiler, ENV.compiler
|
||||||
|
|
||||||
ENV.send MacOS.default_compiler
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -48,6 +48,7 @@ class InstallTests < Test::Unit::TestCase
|
|||||||
# tests use the same formula name without
|
# tests use the same formula name without
|
||||||
# stepping on each other.
|
# stepping on each other.
|
||||||
keg=Keg.new f.prefix
|
keg=Keg.new f.prefix
|
||||||
|
keg.unlink
|
||||||
keg.uninstall
|
keg.uninstall
|
||||||
assert !keg.exist?
|
assert !keg.exist?
|
||||||
assert !f.installed?
|
assert !f.installed?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user