Use assert_predicate

This commit is contained in:
Jack Nagel 2014-06-11 12:21:03 -05:00
parent 06305e6211
commit 58a75b0f71
18 changed files with 242 additions and 243 deletions

View File

@ -17,14 +17,14 @@ class BottleHookTests < Homebrew::TestCase
Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
f.some_random_method
end
assert @fi.pour_bottle?
assert_predicate @fi, :pour_bottle?
end
def test_has_no_bottle
Homebrew::Hooks::Bottles.setup_formula_has_bottle do |f|
!f.some_random_method
end
assert !@fi.pour_bottle?
refute_predicate @fi, :pour_bottle?
end
def test_pour_formula_bottle

View File

@ -12,12 +12,12 @@ class BuildEnvironmentTests < Homebrew::TestCase
def test_std?
@env << :std
assert @env.std?
assert_predicate @env, :std?
end
def test_userpaths?
@env << :userpaths
assert @env.userpaths?
assert_predicate @env, :userpaths?
end
def test_modify_build_environment
@ -31,7 +31,7 @@ class BuildEnvironmentTests < Homebrew::TestCase
@env << :userpaths
@env << Proc.new { 1 }
dump = Marshal.dump(@env)
assert Marshal.load(dump).userpaths?
assert_predicate Marshal.load(dump), :userpaths?
end
def test_env_block
@ -60,12 +60,12 @@ class BuildEnvironmentDSLTests < Homebrew::TestCase
def test_env_single_argument
obj = make_instance { env :userpaths }
assert obj.env.userpaths?
assert_predicate obj.env, :userpaths?
end
def test_env_multiple_arguments
obj = make_instance { env :userpaths, :std }
assert obj.env.userpaths?
assert obj.env.std?
assert_predicate obj.env, :userpaths?
assert_predicate obj.env, :std?
end
end

View File

@ -30,7 +30,7 @@ class CleanerTests < Homebrew::TestCase
def test_prunes_prefix_if_empty
Cleaner.new(@f).clean
assert !@f.prefix.directory?
refute_predicate @f.prefix, :directory?
end
def test_prunes_empty_directories
@ -39,8 +39,8 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !@f.bin.directory?
assert !subdir.directory?
refute_predicate @f.bin, :directory?
refute_predicate subdir, :directory?
end
def test_skip_clean_empty_directory
@ -49,7 +49,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert @f.bin.directory?
assert_predicate @f.bin, :directory?
end
def test_skip_clean_directory_with_empty_subdir
@ -59,8 +59,8 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert @f.bin.directory?
assert subdir.directory?
assert_predicate @f.bin, :directory?
assert_predicate subdir, :directory?
end
def test_removes_symlink_when_target_was_pruned_first
@ -72,9 +72,9 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !dir.exist?
assert !symlink.symlink?
assert !symlink.exist?
refute_predicate dir, :exist?
refute_predicate symlink, :symlink?
refute_predicate symlink, :exist?
end
def test_removes_symlink_pointing_to_empty_directory
@ -86,9 +86,9 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !dir.exist?
assert !symlink.symlink?
assert !symlink.exist?
refute_predicate dir, :exist?
refute_predicate symlink, :symlink?
refute_predicate symlink, :exist?
end
def test_removes_broken_symlinks
@ -97,7 +97,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !symlink.symlink?
refute_predicate symlink, :symlink?
end
def test_skip_clean_broken_symlink
@ -107,7 +107,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert symlink.symlink?
assert_predicate symlink, :symlink?
end
def test_skip_clean_symlink_pointing_to_empty_directory
@ -120,9 +120,9 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !dir.exist?
assert symlink.symlink?
assert !symlink.exist?
refute_predicate dir, :exist?
assert_predicate symlink, :symlink?
refute_predicate symlink, :exist?
end
def test_skip_clean_symlink_when_target_pruned
@ -135,9 +135,9 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !dir.exist?
assert symlink.symlink?
assert !symlink.exist?
refute_predicate dir, :exist?
assert_predicate symlink, :symlink?
refute_predicate symlink, :exist?
end
def test_removes_la_files
@ -148,7 +148,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !file.exist?
refute_predicate file, :exist?
end
def test_skip_clean_la
@ -160,7 +160,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert file.exist?
assert_predicate file, :exist?
end
def test_remove_charset_alias
@ -171,7 +171,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert !file.exist?
refute_predicate file, :exist?
end
def test_skip_clean_subdir
@ -182,7 +182,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert dir.directory?
assert_predicate dir, :directory?
end
def test_skip_clean_paths_are_anchored_to_prefix
@ -195,7 +195,7 @@ class CleanerTests < Homebrew::TestCase
Cleaner.new(@f).clean
assert dir1.exist?
assert !dir2.exist?
assert_predicate dir1, :exist?
refute_predicate dir2, :exist?
end
end

View File

@ -14,14 +14,14 @@ class CleanupTests < Homebrew::TestCase
f3.brew { f3.install }
end
assert f1.installed?
assert f2.installed?
assert f3.installed?
assert_predicate f1, :installed?
assert_predicate f2, :installed?
assert_predicate f3, :installed?
shutup { Homebrew.cleanup_formula(f3) }
assert !f1.installed?
assert !f2.installed?
assert f3.installed?
refute_predicate f1, :installed?
refute_predicate f2, :installed?
assert_predicate f3, :installed?
end
end

View File

@ -12,9 +12,9 @@ class DependableTests < Homebrew::TestCase
end
def test_interrogation
assert @dep.build?
assert !@dep.optional?
assert !@dep.recommended?
assert_predicate @dep, :build?
refute_predicate @dep, :optional?
refute_predicate @dep, :recommended?
end
end

View File

@ -32,8 +32,8 @@ class DependencyCollectorTests < Homebrew::TestCase
end
def test_dependency_tags
assert Dependency.new('foo', [:build]).build?
assert Dependency.new('foo', [:build, :optional]).optional?
assert_predicate Dependency.new('foo', [:build]), :build?
assert_predicate Dependency.new('foo', [:build, :optional]), :optional?
assert Dependency.new('foo', [:universal]).options.include? '--universal'
assert_empty Dependency.new('foo').tags
end
@ -59,7 +59,7 @@ class DependencyCollectorTests < Homebrew::TestCase
@d.add :x11 => '2.5.1'
@d.add :xcode => :build
assert_empty find_requirement(X11Dependency).tags
assert find_requirement(XcodeDependency).build?
assert_predicate find_requirement(XcodeDependency), :build?
end
def test_x11_no_tag
@ -74,14 +74,14 @@ class DependencyCollectorTests < Homebrew::TestCase
def test_x11_tag
@d.add :x11 => :optional
assert find_requirement(X11Dependency).optional?
assert_predicate find_requirement(X11Dependency), :optional?
end
def test_x11_min_version_and_tag
@d.add :x11 => ['2.5.1', :optional]
dep = find_requirement(X11Dependency)
assert_equal '2.5.1', dep.min_version
assert dep.optional?
assert_predicate dep, :optional?
end
def test_ld64_dep_pre_leopard

View File

@ -27,17 +27,17 @@ class FormulaTests < Homebrew::TestCase
def test_installed?
f = TestBall.new
f.stubs(:installed_prefix).returns(stub(:directory? => false))
assert !f.installed?
refute_predicate f, :installed?
f.stubs(:installed_prefix).returns(
stub(:directory? => true, :children => [])
)
assert !f.installed?
refute_predicate f, :installed?
f.stubs(:installed_prefix).returns(
stub(:directory? => true, :children => [stub])
)
assert f.installed?
assert_predicate f, :installed?
end
def test_installed_prefix

View File

@ -24,31 +24,32 @@ class InstallTests < Homebrew::TestCase
keg.uninstall
end
assert !keg.exist?
assert !f.installed?
refute_predicate keg, :exist?
refute_predicate f, :installed?
end
def test_a_basic_install
f=TestBall.new
assert !f.installed?
refute_predicate f, :installed?
temporary_install f do
# Test that things made it into the Keg
assert f.bin.directory?
assert_predicate f.bin, :directory?
assert_equal 3, f.bin.children.length
libexec=f.prefix+'libexec'
assert libexec.directory?
libexec = f.prefix+'libexec'
assert_predicate libexec, :directory?
assert_equal 1, libexec.children.length
assert !(f.prefix+'main.c').exist?
assert f.installed?
refute_predicate f.prefix+'main.c', :exist?
assert_predicate f, :installed?
# Test that things make it into the Cellar
keg=Keg.new f.prefix
keg = Keg.new f.prefix
keg.link
assert_equal 3, HOMEBREW_PREFIX.children.length
assert((HOMEBREW_PREFIX+'bin').directory?)
assert_predicate HOMEBREW_PREFIX+'bin', :directory?
assert_equal 3, (HOMEBREW_PREFIX+'bin').children.length
end
end

View File

@ -19,18 +19,18 @@ class FormulaPinTests < Homebrew::TestCase
end
def test_not_pinnable
assert !@pin.pinnable?
refute_predicate @pin, :pinnable?
end
def test_pinnable_if_kegs_exist
(@f.rack+'0.1').mkpath
assert @pin.pinnable?
assert_predicate @pin, :pinnable?
end
def test_pin
(@f.rack+'0.1').mkpath
@pin.pin
assert @pin.pinned?
assert_predicate @pin, :pinned?
assert_equal 1, FormulaPin::PINDIR.children.length
end
@ -38,7 +38,7 @@ class FormulaPinTests < Homebrew::TestCase
(@f.rack+'0.1').mkpath
@pin.pin
@pin.unpin
assert !@pin.pinned?
refute_predicate @pin, :pinned?
assert_equal 0, FormulaPin::PINDIR.children.length
end

View File

@ -27,7 +27,7 @@ class LinkTests < Homebrew::TestCase
def test_linking_keg
assert_equal 3, @keg.link
(HOMEBREW_PREFIX/"bin").children.each { |c| assert c.readlink.relative? }
(HOMEBREW_PREFIX/"bin").children.each { |c| assert_predicate c.readlink, :relative? }
end
def test_unlinking_keg
@ -39,7 +39,7 @@ class LinkTests < Homebrew::TestCase
@mode.dry_run = true
assert_equal 0, @keg.link(@mode)
assert !@keg.linked?
refute_predicate @keg, :linked?
['hiworld', 'helloworld', 'goodbye_cruel_world'].each do |file|
assert_match "#{HOMEBREW_PREFIX}/bin/#{file}", $stdout.string
@ -89,7 +89,7 @@ class LinkTests < Homebrew::TestCase
@mode.dry_run = true
assert_equal 0, @keg.link(@mode)
assert !@keg.linked?
refute_predicate @keg, :linked?
assert_equal "#{HOMEBREW_PREFIX}/bin/helloworld\n", $stdout.string
end
@ -101,7 +101,7 @@ class LinkTests < Homebrew::TestCase
@keg.unlink
assert !File.directory?(HOMEBREW_PREFIX/"lib/foo")
refute_predicate HOMEBREW_PREFIX/"lib/foo", :directory?
end
def test_unlink_ignores_DS_Store_when_pruning_empty_dirs
@ -112,8 +112,8 @@ class LinkTests < Homebrew::TestCase
@keg.unlink
assert !File.directory?(HOMEBREW_PREFIX/"lib/foo")
assert !File.exist?(HOMEBREW_PREFIX/"lib/foo/.DS_Store")
refute_predicate HOMEBREW_PREFIX/"lib/foo", :directory?
refute_predicate HOMEBREW_PREFIX/"lib/foo/.DS_Store", :exist?
end
def teardown

View File

@ -3,13 +3,11 @@ require 'requirements/language_module_dependency'
class LanguageModuleDependencyTests < Homebrew::TestCase
def assert_deps_fail(spec)
l = LanguageModuleDependency.new(*spec.shift.reverse)
assert !l.satisfied?
refute_predicate LanguageModuleDependency.new(*spec.shift.reverse), :satisfied?
end
def assert_deps_pass(spec)
l = LanguageModuleDependency.new(*spec.shift.reverse)
assert l.satisfied?
assert_predicate LanguageModuleDependency.new(*spec.shift.reverse), :satisfied?
end
def test_unique_deps_are_not_eql

View File

@ -11,106 +11,106 @@ class MachOPathnameTests < Homebrew::TestCase
def test_fat_dylib
pn = dylib_path("fat")
assert pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
assert_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
assert_equal :universal, pn.arch
end
def test_i386_dylib
pn = dylib_path("i386")
assert !pn.universal?
assert pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert !pn.mach_o_bundle?
refute_predicate pn, :universal?
assert_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
assert_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
refute_predicate pn, :mach_o_bundle?
end
def test_x86_64_dylib
pn = dylib_path("x86_64")
assert !pn.universal?
assert !pn.i386?
assert pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert !pn.mach_o_bundle?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
assert_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
assert_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
refute_predicate pn, :mach_o_bundle?
end
def test_mach_o_executable
pn = Pathname.new("#{TEST_DIRECTORY}/mach/a.out")
assert pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert pn.mach_o_executable?
assert !pn.text_executable?
assert !pn.mach_o_bundle?
assert_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
assert_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
refute_predicate pn, :mach_o_bundle?
end
def test_fat_bundle
pn = bundle_path("fat")
assert pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert pn.mach_o_bundle?
assert_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
assert_predicate pn, :mach_o_bundle?
end
def test_i386_bundle
pn = bundle_path("i386")
assert !pn.universal?
assert pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert pn.mach_o_bundle?
refute_predicate pn, :universal?
assert_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
assert_predicate pn, :mach_o_bundle?
end
def test_x86_64_bundle
pn = bundle_path("x86_64")
assert !pn.universal?
assert !pn.i386?
assert pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert pn.mach_o_bundle?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
assert_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
assert_predicate pn, :mach_o_bundle?
end
def test_non_mach_o
pn = Pathname.new("#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz")
assert !pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
assert !pn.mach_o_bundle?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
refute_predicate pn, :mach_o_bundle?
assert_equal :dunno, pn.arch
end
end
@ -121,29 +121,29 @@ class ArchitectureListExtensionTests < MachOPathnameTests
end
def test_architecture_list_extension_universal_checks
assert @archs.universal?
assert @archs.intel_universal?
assert @archs.ppc_universal?
assert @archs.cross_universal?
assert @archs.fat?
assert_predicate @archs, :universal?
assert_predicate @archs, :intel_universal?
assert_predicate @archs, :ppc_universal?
assert_predicate @archs, :cross_universal?
assert_predicate @archs, :fat?
non_universal = [:i386].extend ArchitectureListExtension
assert !non_universal.universal?
refute_predicate non_universal, :universal?
intel_only = [:i386, :x86_64].extend ArchitectureListExtension
assert intel_only.universal?
assert !intel_only.ppc_universal?
assert !intel_only.cross_universal?
assert_predicate intel_only, :universal?
refute_predicate intel_only, :ppc_universal?
refute_predicate intel_only, :cross_universal?
ppc_only = [:ppc970, :ppc64].extend ArchitectureListExtension
assert ppc_only.universal?
assert !ppc_only.intel_universal?
assert !ppc_only.cross_universal?
assert_predicate ppc_only, :universal?
refute_predicate ppc_only, :intel_universal?
refute_predicate ppc_only, :cross_universal?
cross = [:ppc7400, :i386].extend ArchitectureListExtension
assert cross.universal?
assert !cross.intel_universal?
assert !cross.ppc_universal?
assert_predicate cross, :universal?
refute_predicate cross, :intel_universal?
refute_predicate cross, :ppc_universal?
end
def test_architecture_list_extension_massaging_flags
@ -155,7 +155,7 @@ class ArchitectureListExtensionTests < MachOPathnameTests
def test_architecture_list_arch_flags_methods
pn = dylib_path("fat")
assert pn.archs.intel_universal?
assert_predicate pn.archs, :intel_universal?
assert_equal "-arch x86_64 -arch i386", pn.archs.as_arch_flags
assert_equal "x86_64;i386", pn.archs.as_cmake_arch_flags
end
@ -174,42 +174,42 @@ class TextExecutableTests < Homebrew::TestCase
def test_simple_shebang
pn.write '#!/bin/sh'
assert !pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert pn.text_executable?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
assert_predicate pn, :text_executable?
assert_equal [], pn.archs
assert_equal :dunno, pn.arch
end
def test_shebang_with_options
pn.write '#! /usr/bin/perl -w'
assert !pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert pn.text_executable?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
assert_predicate pn, :text_executable?
assert_equal [], pn.archs
assert_equal :dunno, pn.arch
end
def test_malformed_shebang
pn.write ' #!'
assert !pn.universal?
assert !pn.i386?
assert !pn.x86_64?
assert !pn.ppc7400?
assert !pn.ppc64?
assert !pn.dylib?
assert !pn.mach_o_executable?
assert !pn.text_executable?
refute_predicate pn, :universal?
refute_predicate pn, :i386?
refute_predicate pn, :x86_64?
refute_predicate pn, :ppc7400?
refute_predicate pn, :ppc64?
refute_predicate pn, :dylib?
refute_predicate pn, :mach_o_executable?
refute_predicate pn, :text_executable?
assert_equal [], pn.archs
assert_equal :dunno, pn.arch
end

View File

@ -5,14 +5,14 @@ class PatchTests < Homebrew::TestCase
def test_create_simple
patch = Patch.create(:p2)
assert_kind_of ExternalPatch, patch
assert patch.external?
assert_predicate patch, :external?
assert_equal :p2, patch.strip
end
def test_create_io
patch = Patch.create(:p0, StringIO.new("foo"))
assert_kind_of IOPatch, patch
assert !patch.external?
refute_predicate patch, :external?
assert_equal :p0, patch.strip
end

View File

@ -22,18 +22,18 @@ class PathnameExtensionTests < Homebrew::TestCase
touch @dir+'foo'
assert !@dir.rmdir_if_possible
assert @dir.directory?
assert_predicate @dir, :directory?
rm_f @dir+'foo'
assert @dir.rmdir_if_possible
assert !@dir.exist?
refute_predicate @dir, :exist?
end
def test_rmdir_if_possible_ignore_DS_Store
mkdir_p @dir
touch @dir+'.DS_Store'
assert @dir.rmdir_if_possible
assert !@dir.exist?
refute_predicate @dir, :exist?
end
def test_write
@ -68,8 +68,8 @@ class PathnameExtensionTests < Homebrew::TestCase
def test_ensure_writable
touch @file
chmod 0555, @file
@file.ensure_writable { assert @file.writable? }
assert !@file.writable?
@file.ensure_writable { assert_predicate @file, :writable? }
refute_predicate @file, :writable?
end
def test_extname
@ -92,8 +92,8 @@ class PathnameExtensionTests < Homebrew::TestCase
touch @file
@dst.install(@file)
assert (@dst/@file.basename).exist?
assert !@file.exist?
assert_predicate @dst/@file.basename, :exist?
refute_predicate @file, :exist?
end
def setup_install_test
@ -108,8 +108,8 @@ class PathnameExtensionTests < Homebrew::TestCase
setup_install_test do
@dst.install 'a.txt'
assert((@dst+'a.txt').exist?, 'a.txt not installed.')
assert(!(@dst+'b.txt').exist?, 'b.txt was installed.')
assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed"
refute_predicate @dst+"b.txt", :exist?, "b.txt was installed."
end
end
@ -117,8 +117,8 @@ class PathnameExtensionTests < Homebrew::TestCase
setup_install_test do
@dst.install %w[a.txt b.txt]
assert((@dst+'a.txt').exist?, 'a.txt not installed.')
assert((@dst+'b.txt').exist?, 'b.txt not installed.')
assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed"
assert_predicate @dst+"b.txt", :exist?, "b.txt was not installed"
end
end
@ -126,8 +126,8 @@ class PathnameExtensionTests < Homebrew::TestCase
setup_install_test do
@dst.install Dir['*.txt']
assert((@dst+'a.txt').exist?, 'a.txt not installed.')
assert((@dst+'b.txt').exist?, 'b.txt not installed.')
assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed"
assert_predicate @dst+"b.txt", :exist?, "b.txt was not installed"
end
end
@ -138,8 +138,8 @@ class PathnameExtensionTests < Homebrew::TestCase
@dst.install 'bin'
assert((@dst+'bin/a.txt').exist?, 'a.txt not installed.')
assert((@dst+'bin/b.txt').exist?, 'b.txt not installed.')
assert_predicate @dst+"bin/a.txt", :exist?, "a.txt was not installed"
assert_predicate @dst+"bin/b.txt", :exist?, "b.txt was not installed"
end
end
@ -147,9 +147,9 @@ class PathnameExtensionTests < Homebrew::TestCase
setup_install_test do
@dst.install 'a.txt' => 'c.txt'
assert((@dst+'c.txt').exist?, 'c.txt not installed.')
assert(!(@dst+'a.txt').exist?, 'a.txt was installed but not renamed.')
assert(!(@dst+'b.txt').exist?, 'b.txt was installed.')
assert_predicate @dst+"c.txt", :exist?, "c.txt was not installed"
refute_predicate @dst+"a.txt", :exist?, "a.txt was installed but not renamed"
refute_predicate @dst+"b.txt", :exist?, "b.txt was installed"
end
end
@ -157,10 +157,10 @@ class PathnameExtensionTests < Homebrew::TestCase
setup_install_test do
@dst.install({'a.txt' => 'c.txt', 'b.txt' => 'd.txt'})
assert((@dst+'c.txt').exist?, 'c.txt not installed.')
assert((@dst+'d.txt').exist?, 'd.txt not installed.')
assert(!(@dst+'a.txt').exist?, 'a.txt was installed but not renamed.')
assert(!(@dst+'b.txt').exist?, 'b.txt was installed but not renamed.')
assert_predicate @dst+"c.txt", :exist?, "c.txt was not installed"
assert_predicate @dst+"d.txt", :exist?, "d.txt was not installed"
refute_predicate @dst+"a.txt", :exist?, "a.txt was installed but not renamed"
refute_predicate @dst+"b.txt", :exist?, "b.txt was installed but not renamed"
end
end
@ -171,9 +171,9 @@ class PathnameExtensionTests < Homebrew::TestCase
@dst.install 'bin' => 'libexec'
assert(!(@dst+'bin').exist?, 'bin was installed but not renamed.')
assert((@dst+'libexec/a.txt').exist?, 'a.txt not installed.')
assert((@dst+'libexec/b.txt').exist?, 'b.txt not installed.')
refute_predicate @dst+"bin", :exist?, "bin was installed but not renamed"
assert_predicate @dst+"libexec/a.txt", :exist?, "a.txt was not installed"
assert_predicate @dst+"libexec/b.txt", :exist?, "b.txt was not installed"
end
end
@ -184,19 +184,19 @@ class PathnameExtensionTests < Homebrew::TestCase
@dst.install_symlink @src+'bin'
assert((@dst+'bin').symlink?)
assert((@dst+'bin').directory?)
assert((@dst+'bin/a.txt').exist?)
assert((@dst+'bin/b.txt').exist?)
assert_predicate @dst+"bin", :symlink?
assert_predicate @dst+"bin", :directory?
assert_predicate @dst+"bin/a.txt", :exist?
assert_predicate @dst+"bin/b.txt", :exist?
assert((@dst+'bin').readlink.relative?)
assert_predicate (@dst+"bin").readlink, :relative?
end
end
def test_install_creates_intermediate_directories
touch @file
assert !@dir.directory?
refute_predicate @dir, :directory?
@dir.install(@file)
assert @dir.directory?
assert_predicate @dir, :directory?
end
end

View File

@ -24,28 +24,28 @@ class RequirementTests < Homebrew::TestCase
def test_dsl_fatal
req = Class.new(Requirement) { fatal true }.new
assert req.fatal?
assert_predicate req, :fatal?
end
def test_satisfy_true
req = Class.new(Requirement) do
satisfy(:build_env => false) { true }
end.new
assert req.satisfied?
assert_predicate req, :satisfied?
end
def test_satisfy_false
req = Class.new(Requirement) do
satisfy(:build_env => false) { false }
end.new
assert !req.satisfied?
refute_predicate req, :satisfied?
end
def test_satisfy_with_boolean
req = Class.new(Requirement) do
satisfy true
end.new
assert req.satisfied?
assert_predicate req, :satisfied?
end
def test_satisfy_sets_up_build_env_by_default
@ -55,7 +55,7 @@ class RequirementTests < Homebrew::TestCase
ENV.expects(:with_build_environment).yields.returns(true)
assert req.satisfied?
assert_predicate req, :satisfied?
end
def test_satisfy_build_env_can_be_disabled
@ -65,7 +65,7 @@ class RequirementTests < Homebrew::TestCase
ENV.expects(:with_build_environment).never
assert req.satisfied?
assert_predicate req, :satisfied?
end
def test_infers_path_from_satisfy_result
@ -83,7 +83,7 @@ class RequirementTests < Homebrew::TestCase
def test_dsl_build
req = Class.new(Requirement) { build true }.new
assert req.build?
assert_predicate req, :build?
end
def test_infer_name_from_class
@ -101,7 +101,7 @@ class RequirementTests < Homebrew::TestCase
def test_dsl_default_formula
req = Class.new(Requirement) { default_formula 'foo' }.new
assert req.default_formula?
assert_predicate req, :default_formula?
end
def test_to_dependency

View File

@ -49,13 +49,13 @@ class ResourceTests < Homebrew::TestCase
def test_version
@resource.version('1.0')
assert_version_equal '1.0', @resource.version
assert !@resource.version.detected_from_url?
refute_predicate @resource.version, :detected_from_url?
end
def test_version_from_url
@resource.url('http://example.com/foo-1.0.tar.gz')
assert_version_equal '1.0', @resource.version
assert @resource.version.detected_from_url?
assert_predicate @resource.version, :detected_from_url?
end
def test_version_with_scheme
@ -68,7 +68,7 @@ class ResourceTests < Homebrew::TestCase
def test_version_from_tag
@resource.url('http://example.com/foo-1.0.tar.gz', :tag => 'v1.0.2')
assert_version_equal '1.0.2', @resource.version
assert @resource.version.detected_from_url?
assert_predicate @resource.version, :detected_from_url?
end
def test_rejects_non_string_versions

View File

@ -44,11 +44,11 @@ class CxxStdlibTests < Homebrew::TestCase
end
def test_apple_compiler_reporting
assert @clang.apple_compiler?
assert @gcc.apple_compiler?
assert @llvm.apple_compiler?
assert @gcc4.apple_compiler?
assert !@gcc48.apple_compiler?
assert_predicate @clang, :apple_compiler?
assert_predicate @gcc, :apple_compiler?
assert_predicate @llvm, :apple_compiler?
assert_predicate @gcc4, :apple_compiler?
refute_predicate @gcc48, :apple_compiler?
end
def test_type_string_formatting

View File

@ -61,13 +61,13 @@ class UpdaterTests < Homebrew::TestCase
def test_update_homebrew_without_any_changes
perform_update
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
assert_empty @report
end
def test_update_homebrew_without_formulae_changes
perform_update(fixture('update_git_diff_output_without_formulae_changes'))
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
assert_empty @report.select_formula(:M)
assert_empty @report.select_formula(:A)
assert_empty @report.select_formula(:R)
@ -75,7 +75,7 @@ class UpdaterTests < Homebrew::TestCase
def test_update_homebrew_with_formulae_changes
perform_update(fixture('update_git_diff_output_with_formulae_changes'))
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
assert_equal %w{ xar yajl }, @report.select_formula(:M)
assert_equal %w{ antiword bash-completion ddrescue dict lua }, @report.select_formula(:A)
assert_equal %w{ shapelib }, @report.select_formula(:R)
@ -83,7 +83,7 @@ class UpdaterTests < Homebrew::TestCase
def test_update_homebrew_with_tapped_formula_changes
perform_update(fixture('update_git_diff_output_with_tapped_formulae_changes'))
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
assert_equal [
HOMEBREW_LIBRARY.join("Taps", "someuser/sometap/Formula/antiword.rb"),
HOMEBREW_LIBRARY.join("Taps", "someuser/sometap/HomebrewFormula/lua.rb"),
@ -93,12 +93,12 @@ class UpdaterTests < Homebrew::TestCase
def test_update_homebrew_with_removed_formulae
perform_update(fixture('update_git_diff_output_with_removed_formulae'))
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
assert_equal %w{libgsasl}, @report.select_formula(:D)
end
def test_update_homebrew_with_changed_filetype
perform_update(fixture('update_git_diff_output_with_changed_filetype'))
assert @updater.expectations_met?
assert_predicate @updater, :expectations_met?
end
end