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
|
||||
|
||||
def teardown
|
||||
ARGV.reset
|
||||
end
|
||||
|
||||
def test_ARGV
|
||||
assert ARGV.named.empty?
|
||||
|
||||
@ -31,7 +35,6 @@ class ARGVTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_switch?
|
||||
ARGV.reset
|
||||
ARGV.unshift "-ns"
|
||||
ARGV.unshift "-i"
|
||||
ARGV.unshift "--bar"
|
||||
|
@ -171,6 +171,8 @@ class BeerTasting < Test::Unit::TestCase
|
||||
assert orig_abcd.exist?
|
||||
|
||||
HOMEBREW_CACHE.chmod_R 0777
|
||||
|
||||
abcd.unlink # teardown
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,17 +8,16 @@ ENV.extend(HomebrewEnvExtension)
|
||||
|
||||
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
|
||||
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
|
||||
ENV.unset_use_cc
|
||||
f = TestLLVMFailure.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -32,12 +31,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
when 0..210 then :gcc
|
||||
else :clang
|
||||
end, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_all_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestAllCompilerFailures.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -48,12 +44,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
cs.select_compiler
|
||||
|
||||
assert_equal MacOS.default_compiler, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_no_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestNoCompilerFailures.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -67,12 +60,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
cs.select_compiler
|
||||
|
||||
assert_equal MacOS.default_compiler, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_mixed_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestMixedCompilerFailures.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -83,12 +73,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
cs.select_compiler
|
||||
|
||||
assert_equal :llvm, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_more_mixed_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestMoreMixedCompilerFailures.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -99,12 +86,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
cs.select_compiler
|
||||
|
||||
assert_equal :clang, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_even_more_mixed_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestEvenMoreMixedCompilerFailures.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -121,12 +105,9 @@ class CompilerTests < Test::Unit::TestCase
|
||||
when 0..210 then :gcc
|
||||
else :clang
|
||||
end, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
|
||||
def test_block_with_no_build_compiler_failures
|
||||
ENV.unset_use_cc
|
||||
f = TestBlockWithoutBuildCompilerFailure.new
|
||||
cs = CompilerSelector.new(f)
|
||||
|
||||
@ -137,7 +118,5 @@ class CompilerTests < Test::Unit::TestCase
|
||||
cs.select_compiler
|
||||
|
||||
assert_equal MacOS.default_compiler, ENV.compiler
|
||||
|
||||
ENV.send MacOS.default_compiler
|
||||
end
|
||||
end
|
||||
|
@ -48,6 +48,7 @@ class InstallTests < Test::Unit::TestCase
|
||||
# tests use the same formula name without
|
||||
# stepping on each other.
|
||||
keg=Keg.new f.prefix
|
||||
keg.unlink
|
||||
keg.uninstall
|
||||
assert !keg.exist?
|
||||
assert !f.installed?
|
||||
|
Loading…
x
Reference in New Issue
Block a user