diff options
| author | Jack Nagel | 2014-06-10 22:43:47 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-18 20:34:09 -0500 |
| commit | 16884ea08e115723ca595bf29389cddef54f9c63 (patch) | |
| tree | 79e3c0c89981c4978cda2889129fd771e64cb00f /Library/Homebrew/test | |
| parent | 203653e821c40a68dbdfd9a9457214dfa63111ad (diff) | |
| download | homebrew-16884ea08e115723ca595bf29389cddef54f9c63.tar.bz2 | |
Switch to Minitest
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/Rakefile | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_checksum.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_compiler_selector.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_dependencies.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_dependency.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_download_strategies.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_keg.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_language_module_dependency.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_options.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_requirement.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_x11_dependency.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testing_env.rb | 23 |
13 files changed, 29 insertions, 32 deletions
diff --git a/Library/Homebrew/test/Rakefile b/Library/Homebrew/test/Rakefile index 6720cf2f5..ea61abef8 100644 --- a/Library/Homebrew/test/Rakefile +++ b/Library/Homebrew/test/Rakefile @@ -3,7 +3,7 @@ require 'rake/testtask' TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__)) TEST_FILES = Dir["#{TEST_DIRECTORY}/test_*.rb"] -GEM_DEPS = ['mocha'] +GEM_DEPS = %w[mocha minitest] task :default => :test diff --git a/Library/Homebrew/test/test_checksum.rb b/Library/Homebrew/test/test_checksum.rb index 6212417b8..6ac9f2029 100644 --- a/Library/Homebrew/test/test_checksum.rb +++ b/Library/Homebrew/test/test_checksum.rb @@ -13,11 +13,11 @@ class ChecksumTests < Homebrew::TestCase a = Checksum.new(:sha1, 'deadbeef'*5) b = Checksum.new(:sha1, 'feedface'*5) - assert_not_equal a, b + refute_equal a, b a = Checksum.new(:sha1, 'deadbeef'*5) b = Checksum.new(:sha256, 'deadbeef'*5) - assert_not_equal a, b + refute_equal a, b end end diff --git a/Library/Homebrew/test/test_compiler_selector.rb b/Library/Homebrew/test/test_compiler_selector.rb index f447c6b5d..c379e5713 100644 --- a/Library/Homebrew/test/test_compiler_selector.rb +++ b/Library/Homebrew/test/test_compiler_selector.rb @@ -50,7 +50,7 @@ class CompilerSelectorTests < Homebrew::TestCase def test_all_compiler_failures @f << :clang << :llvm << :gcc << 'gcc-4.8' - assert_raise(CompilerSelectionError) { actual_cc } + assert_raises(CompilerSelectionError) { actual_cc } end def test_no_compiler_failures @@ -111,7 +111,7 @@ class CompilerSelectorTests < Homebrew::TestCase def test_missing_gcc @versions = CompilerVersions.new( :gcc_build_version => nil) @f << :clang << :llvm << 'gcc-4.8' - assert_raise(CompilerSelectionError) { actual_cc } + assert_raises(CompilerSelectionError) { actual_cc } end def test_missing_llvm_and_gcc @@ -120,6 +120,6 @@ class CompilerSelectorTests < Homebrew::TestCase :llvm_build_version => nil ) @f << :clang << 'gcc-4.8' - assert_raise(CompilerSelectionError) { actual_cc } + assert_raises(CompilerSelectionError) { actual_cc } end end diff --git a/Library/Homebrew/test/test_dependencies.rb b/Library/Homebrew/test/test_dependencies.rb index a935bcba4..88c101551 100644 --- a/Library/Homebrew/test/test_dependencies.rb +++ b/Library/Homebrew/test/test_dependencies.rb @@ -74,7 +74,7 @@ class DependenciesTests < Homebrew::TestCase b << Dependency.new("bar", [:optional]) - assert_not_equal a, b + refute_equal a, b assert !a.eql?(b) end end diff --git a/Library/Homebrew/test/test_dependency.rb b/Library/Homebrew/test/test_dependency.rb index e12d893ea..bf462300e 100644 --- a/Library/Homebrew/test/test_dependency.rb +++ b/Library/Homebrew/test/test_dependency.rb @@ -45,7 +45,7 @@ class DependencyTests < Homebrew::TestCase bar = Dependency.new("bar") assert_equal foo1, foo2 assert foo1.eql?(foo2) - assert_not_equal foo1, bar + refute_equal foo1, bar assert !foo1.eql?(bar) end end diff --git a/Library/Homebrew/test/test_download_strategies.rb b/Library/Homebrew/test/test_download_strategies.rb index 0e9642cc0..16ee28369 100644 --- a/Library/Homebrew/test/test_download_strategies.rb +++ b/Library/Homebrew/test/test_download_strategies.rb @@ -32,7 +32,7 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase def test_expand_safe_system_args_does_not_mutate_argument result = @strategy.expand_safe_system_args(@args) assert_equal %w{foo bar baz}, @args - assert_not_same @args, result + refute_same @args, result end end diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index eda6933fe..2104781a6 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -131,15 +131,15 @@ class FormulaTests < Homebrew::TestCase def test_inequality x = TestBall.new("foo") y = TestBall.new("bar") - assert_not_equal x, y - assert_not_equal y, x - assert_not_equal x.hash, y.hash + refute_equal x, y + refute_equal y, x + refute_equal x.hash, y.hash assert !x.eql?(y) assert !y.eql?(x) end def test_comparison_with_non_formula_objects_does_not_raise - assert_not_equal TestBall.new, Object.new + refute_equal TestBall.new, Object.new end def test_class_naming diff --git a/Library/Homebrew/test/test_keg.rb b/Library/Homebrew/test/test_keg.rb index e9e5acfb1..ff22a1140 100644 --- a/Library/Homebrew/test/test_keg.rb +++ b/Library/Homebrew/test/test_keg.rb @@ -49,14 +49,14 @@ class LinkTests < Homebrew::TestCase def test_linking_fails_when_already_linked @keg.link - assert_raise Keg::AlreadyLinkedError do + assert_raises Keg::AlreadyLinkedError do shutup { @keg.link } end end def test_linking_fails_when_files_exist touch HOMEBREW_PREFIX/"bin/helloworld" - assert_raise Keg::ConflictError do + assert_raises Keg::ConflictError do shutup { @keg.link } end end diff --git a/Library/Homebrew/test/test_language_module_dependency.rb b/Library/Homebrew/test/test_language_module_dependency.rb index 10ddc3c28..fcf6c36a8 100644 --- a/Library/Homebrew/test/test_language_module_dependency.rb +++ b/Library/Homebrew/test/test_language_module_dependency.rb @@ -15,7 +15,7 @@ class LanguageModuleDependencyTests < Homebrew::TestCase def test_unique_deps_are_not_eql x = LanguageModuleDependency.new(:node, "less") y = LanguageModuleDependency.new(:node, "coffee-script") - assert_not_equal x.hash, y.hash + refute_equal x.hash, y.hash assert !x.eql?(y) assert !y.eql?(x) end diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb index 559beab2d..96d1ecf05 100644 --- a/Library/Homebrew/test/test_options.rb +++ b/Library/Homebrew/test/test_options.rb @@ -18,7 +18,7 @@ class OptionTests < Homebrew::TestCase foo = Option.new("foo") bar = Option.new("bar") assert_equal foo, @option - assert_not_equal bar, @option + refute_equal bar, @option assert @option.eql?(foo) assert !@option.eql?(bar) assert_operator bar, :<, foo diff --git a/Library/Homebrew/test/test_requirement.rb b/Library/Homebrew/test/test_requirement.rb index 3f78ad53f..5efb21fd9 100644 --- a/Library/Homebrew/test/test_requirement.rb +++ b/Library/Homebrew/test/test_requirement.rb @@ -132,7 +132,7 @@ class RequirementTests < Homebrew::TestCase def test_not_eql a, b = Requirement.new([:optional]), Requirement.new - assert_not_equal a.hash, b.hash + refute_equal a.hash, b.hash assert !a.eql?(b) assert !b.eql?(a) end diff --git a/Library/Homebrew/test/test_x11_dependency.rb b/Library/Homebrew/test/test_x11_dependency.rb index 61575f94f..9bbc578e7 100644 --- a/Library/Homebrew/test/test_x11_dependency.rb +++ b/Library/Homebrew/test/test_x11_dependency.rb @@ -14,7 +14,7 @@ class X11DependencyTests < Homebrew::TestCase def test_not_eql_when_hashes_differ x = X11Dependency.new("foo") y = X11Dependency.new - assert_not_equal x.hash, y.hash + refute_equal x.hash, y.hash assert !x.eql?(y) assert !y.eql?(x) end diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb index 76e1b19f3..25478de92 100644 --- a/Library/Homebrew/test/testing_env.rb +++ b/Library/Homebrew/test/testing_env.rb @@ -5,6 +5,7 @@ $:.push(File.expand_path(__FILE__+'/../..')) require 'extend/module' require 'extend/fileutils' require 'extend/pathname' +require 'extend/ARGV' require 'extend/string' require 'extend/symbol' require 'extend/enumerable' @@ -56,22 +57,14 @@ at_exit { HOMEBREW_PREFIX.parent.rmtree } # Test fixtures and files can be found relative to this path TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__)) -require 'test/unit' # must be after at_exit -require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser ARGV.extend(HomebrewArgvExtension) begin - require 'rubygems' - require 'mocha/setup' + require "rubygems" + require "minitest/autorun" + require "mocha/setup" rescue LoadError - warn 'The mocha gem is required to run some tests, expect failures' -end - -module Test::Unit::Assertions - def assert_empty(obj, msg=nil) - assert_respond_to(obj, :empty?, msg) - assert(obj.empty?, msg) - end unless method_defined?(:assert_empty) + abort "Run `rake deps` or install the mocha and minitest gems before running the tests" end module Homebrew @@ -97,7 +90,7 @@ module Homebrew end end - class TestCase < ::Test::Unit::TestCase + class TestCase < ::Minitest::Test include VersionAssertions TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze @@ -120,5 +113,9 @@ module Homebrew $stdout.reopen(out) end end + + def assert_nothing_raised + yield + end end end |
