tests: fix code style issues (#587)
This commit is contained in:
parent
d59f0f77a7
commit
8ec59253df
5
Library/Homebrew/test/.rubocop.yml
Normal file
5
Library/Homebrew/test/.rubocop.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
inherit_from: ../../.rubocop.yml
|
||||||
|
|
||||||
|
# `formula do` uses nested method definitions
|
||||||
|
Style/NestedMethodDefinition:
|
||||||
|
Enabled: false
|
||||||
@ -3,11 +3,11 @@ require "pathname"
|
|||||||
|
|
||||||
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"])
|
||||||
|
|
||||||
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") { |k|
|
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
|
||||||
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
|
dir = Dir.mktmpdir("homebrew-tests-", ENV["HOMEBREW_TEMP"] || "/tmp")
|
||||||
at_exit { FileUtils.remove_entry(dir) }
|
at_exit { FileUtils.remove_entry(dir) }
|
||||||
ENV[k] = dir
|
ENV[k] = dir
|
||||||
}
|
end
|
||||||
|
|
||||||
# Paths pointing into the Homebrew code base that persist across test runs
|
# Paths pointing into the Homebrew code base that persist across test runs
|
||||||
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__))
|
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__))
|
||||||
@ -25,8 +25,8 @@ HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar"
|
|||||||
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
|
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
|
||||||
HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp"
|
HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp"
|
||||||
|
|
||||||
TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37"
|
TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37".freeze
|
||||||
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b"
|
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze
|
||||||
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9"
|
TESTBALL_PATCHES_SHA256 = "799c2d551ac5c3a5759bea7796631a7906a6a24435b52261a317133a0bfb34d9".freeze
|
||||||
PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa"
|
PATCH_A_SHA256 = "83404f4936d3257e65f176c4ffb5a5b8d6edd644a21c8d8dcc73e22a6d28fcfa".freeze
|
||||||
PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b90"
|
PATCH_B_SHA256 = "57958271bb802a59452d0816e0670d16c8b70bdf6530bcf6f78726489ad89b90".freeze
|
||||||
|
|||||||
@ -6,7 +6,10 @@ class BottleHookTests < Homebrew::TestCase
|
|||||||
class FormulaDouble
|
class FormulaDouble
|
||||||
def bottle; end
|
def bottle; end
|
||||||
def local_bottle_path; end
|
def local_bottle_path; end
|
||||||
def bottle_disabled?; false end
|
|
||||||
|
def bottle_disabled?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def some_random_method
|
def some_random_method
|
||||||
true
|
true
|
||||||
|
|||||||
@ -20,4 +20,3 @@ class ChecksumTests < Homebrew::TestCase
|
|||||||
refute_equal a, b
|
refute_equal a, b
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -47,12 +47,12 @@ class DependencyTests < Homebrew::TestCase
|
|||||||
assert_equal 2, merged.length
|
assert_equal 2, merged.length
|
||||||
assert_equal Dependency, merged.first.class
|
assert_equal Dependency, merged.first.class
|
||||||
|
|
||||||
foo_named_dep = merged.find {|d| d.name == "foo"}
|
foo_named_dep = merged.find { |d| d.name == "foo" }
|
||||||
assert_equal ["bar"], foo_named_dep.tags
|
assert_equal ["bar"], foo_named_dep.tags
|
||||||
assert_includes foo_named_dep.option_names, "foo"
|
assert_includes foo_named_dep.option_names, "foo"
|
||||||
assert_includes foo_named_dep.option_names, "foo2"
|
assert_includes foo_named_dep.option_names, "foo2"
|
||||||
|
|
||||||
xyz_named_dep = merged.find {|d| d.name == "xyz"}
|
xyz_named_dep = merged.find { |d| d.name == "xyz" }
|
||||||
assert_equal ["abc"], xyz_named_dep.tags
|
assert_equal ["abc"], xyz_named_dep.tags
|
||||||
assert_includes xyz_named_dep.option_names, "foo"
|
assert_includes xyz_named_dep.option_names, "foo"
|
||||||
refute_includes xyz_named_dep.option_names, "foo2"
|
refute_includes xyz_named_dep.option_names, "foo2"
|
||||||
|
|||||||
@ -87,10 +87,13 @@ class DependencyExpansionTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_skip_skips_parent_but_yields_children
|
def test_skip_skips_parent_but_yields_children
|
||||||
f = stub(:name => "f", :deps => [
|
f = stub(
|
||||||
build_dep(:foo, [], [@bar, @baz]),
|
:name => "f",
|
||||||
build_dep(:foo, [], [@baz])
|
:deps => [
|
||||||
])
|
build_dep(:foo, [], [@bar, @baz]),
|
||||||
|
build_dep(:foo, [], [@baz]),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
deps = Dependency.expand(f) do |_dependent, dep|
|
deps = Dependency.expand(f) do |_dependent, dep|
|
||||||
Dependency.skip if %w[foo qux].include? dep.name
|
Dependency.skip if %w[foo qux].include? dep.name
|
||||||
|
|||||||
@ -105,11 +105,11 @@ class DiagnosticChecksTest < Homebrew::TestCase
|
|||||||
sep = File::PATH_SEPARATOR
|
sep = File::PATH_SEPARATOR
|
||||||
# ensure /usr/bin is before HOMEBREW_PREFIX/bin in the PATH
|
# ensure /usr/bin is before HOMEBREW_PREFIX/bin in the PATH
|
||||||
ENV["PATH"] = "/usr/bin#{sep}#{bin}#{sep}" +
|
ENV["PATH"] = "/usr/bin#{sep}#{bin}#{sep}" +
|
||||||
ENV["PATH"].gsub(%r{(?:^|#{sep})(?:/usr/bin|#{bin})}, "")
|
ENV["PATH"].gsub(%r{(?:^|#{sep})(?:/usr/bin|#{bin})}, "")
|
||||||
|
|
||||||
# ensure there's at least one file with the same name in both /usr/bin/ and
|
# ensure there's at least one file with the same name in both /usr/bin/ and
|
||||||
# HOMEBREW_PREFIX/bin/
|
# HOMEBREW_PREFIX/bin/
|
||||||
(bin/"#{File.basename Dir["/usr/bin/*"].first}").mkpath
|
(bin/File.basename(Dir["/usr/bin/*"].first)).mkpath
|
||||||
|
|
||||||
assert_match "/usr/bin occurs before #{HOMEBREW_PREFIX}/bin",
|
assert_match "/usr/bin occurs before #{HOMEBREW_PREFIX}/bin",
|
||||||
@checks.check_user_path_1
|
@checks.check_user_path_1
|
||||||
@ -129,7 +129,7 @@ class DiagnosticChecksTest < Homebrew::TestCase
|
|||||||
def test_check_user_path_sbin
|
def test_check_user_path_sbin
|
||||||
sbin = HOMEBREW_PREFIX/"sbin"
|
sbin = HOMEBREW_PREFIX/"sbin"
|
||||||
ENV["PATH"] = "#{HOMEBREW_PREFIX}/bin#{File::PATH_SEPARATOR}" +
|
ENV["PATH"] = "#{HOMEBREW_PREFIX}/bin#{File::PATH_SEPARATOR}" +
|
||||||
ENV["PATH"].gsub(%r{(?:^|#{File::PATH_SEPARATOR})#{sbin}}, "")
|
ENV["PATH"].gsub(/(?:^|#{Regexp.escape(File::PATH_SEPARATOR)})#{Regexp.escape(sbin)}/, "")
|
||||||
(sbin/"something").mkpath
|
(sbin/"something").mkpath
|
||||||
|
|
||||||
assert_nil @checks.check_user_path_1
|
assert_nil @checks.check_user_path_1
|
||||||
@ -162,7 +162,7 @@ class DiagnosticChecksTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_check_DYLD_vars
|
def test_check_dyld_vars
|
||||||
ENV["DYLD_INSERT_LIBRARIES"] = "foo"
|
ENV["DYLD_INSERT_LIBRARIES"] = "foo"
|
||||||
assert_match "Setting DYLD_INSERT_LIBRARIES",
|
assert_match "Setting DYLD_INSERT_LIBRARIES",
|
||||||
@checks.check_DYLD_vars
|
@checks.check_DYLD_vars
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class ExceptionsTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_tap_formula_unavailable_error
|
def test_tap_formula_unavailable_error
|
||||||
t = stub({:user => "u", :repo => "r", :to_s => "u/r", :installed? => false})
|
t = stub(:user => "u", :repo => "r", :to_s => "u/r", :installed? => false)
|
||||||
assert_match "Please tap it and then try again: brew tap u/r",
|
assert_match "Please tap it and then try again: brew tap u/r",
|
||||||
TapFormulaUnavailableError.new(t, "foo").to_s
|
TapFormulaUnavailableError.new(t, "foo").to_s
|
||||||
end
|
end
|
||||||
@ -73,7 +73,7 @@ class ExceptionsTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_build_error
|
def test_build_error
|
||||||
f = stub({:name => "foo"})
|
f = stub(:name => "foo")
|
||||||
assert_equal "Failed executing: badprg arg1 arg2",
|
assert_equal "Failed executing: badprg arg1 arg2",
|
||||||
BuildError.new(f, "badprg", %w[arg1 arg2], {}).to_s
|
BuildError.new(f, "badprg", %w[arg1 arg2], {}).to_s
|
||||||
end
|
end
|
||||||
@ -84,20 +84,20 @@ class ExceptionsTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_formula_installation_already_attempted_error
|
def test_formula_installation_already_attempted_error
|
||||||
f = stub({:full_name => "foo/bar"})
|
f = stub(:full_name => "foo/bar")
|
||||||
assert_equal "Formula installation already attempted: foo/bar",
|
assert_equal "Formula installation already attempted: foo/bar",
|
||||||
FormulaInstallationAlreadyAttemptedError.new(f).to_s
|
FormulaInstallationAlreadyAttemptedError.new(f).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_formula_conflict_error
|
def test_formula_conflict_error
|
||||||
f = stub({:full_name => "foo/qux"})
|
f = stub(:full_name => "foo/qux")
|
||||||
c = stub({:name => "bar", :reason => "I decided to"})
|
c = stub(:name => "bar", :reason => "I decided to")
|
||||||
assert_match "Please `brew unlink bar` before continuing.",
|
assert_match "Please `brew unlink bar` before continuing.",
|
||||||
FormulaConflictError.new(f, [c]).to_s
|
FormulaConflictError.new(f, [c]).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compiler_selection_error
|
def test_compiler_selection_error
|
||||||
f = stub({:full_name => "foo"})
|
f = stub(:full_name => "foo")
|
||||||
assert_match "foo cannot be built with any available compilers.",
|
assert_match "foo cannot be built with any available compilers.",
|
||||||
CompilerSelectionError.new(f).to_s
|
CompilerSelectionError.new(f).to_s
|
||||||
end
|
end
|
||||||
@ -115,27 +115,27 @@ class ExceptionsTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_checksum_mismatch_error
|
def test_checksum_mismatch_error
|
||||||
h1 = stub({:hash_type => "sha256", :to_s => "deadbeef"})
|
h1 = stub(:hash_type => "sha256", :to_s => "deadbeef")
|
||||||
h2 = stub({:hash_type => "sha256", :to_s => "deadcafe"})
|
h2 = stub(:hash_type => "sha256", :to_s => "deadcafe")
|
||||||
assert_match "SHA256 mismatch",
|
assert_match "SHA256 mismatch",
|
||||||
ChecksumMismatchError.new("/file.tar.gz", h1, h2).to_s
|
ChecksumMismatchError.new("/file.tar.gz", h1, h2).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_resource_missing_error
|
def test_resource_missing_error
|
||||||
f = stub({:full_name => "bar"})
|
f = stub(:full_name => "bar")
|
||||||
r = stub({:inspect => "<resource foo>"})
|
r = stub(:inspect => "<resource foo>")
|
||||||
assert_match "bar does not define resource <resource foo>",
|
assert_match "bar does not define resource <resource foo>",
|
||||||
ResourceMissingError.new(f, r).to_s
|
ResourceMissingError.new(f, r).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_duplicate_resource_error
|
def test_duplicate_resource_error
|
||||||
r = stub({:inspect => "<resource foo>"})
|
r = stub(:inspect => "<resource foo>")
|
||||||
assert_equal "Resource <resource foo> is defined more than once",
|
assert_equal "Resource <resource foo> is defined more than once",
|
||||||
DuplicateResourceError.new(r).to_s
|
DuplicateResourceError.new(r).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_bottle_version_mismatch_error
|
def test_bottle_version_mismatch_error
|
||||||
f = stub({:full_name => "foo"})
|
f = stub(:full_name => "foo")
|
||||||
assert_match "Bottle version mismatch",
|
assert_match "Bottle version mismatch",
|
||||||
BottleVersionMismatchError.new("/foo.bottle.tar.gz", "1.0", f, "1.1").to_s
|
BottleVersionMismatchError.new("/foo.bottle.tar.gz", "1.0", f, "1.1").to_s
|
||||||
end
|
end
|
||||||
|
|||||||
@ -529,7 +529,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
|||||||
@f.rack.rmtree
|
@f.rack.rmtree
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_tab_for_prefix(prefix, tap_string=nil)
|
def setup_tab_for_prefix(prefix, tap_string = nil)
|
||||||
prefix.mkpath
|
prefix.mkpath
|
||||||
tab = Tab.empty
|
tab = Tab.empty
|
||||||
tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
|
tab.tabfile = prefix.join("INSTALL_RECEIPT.json")
|
||||||
|
|||||||
@ -3,11 +3,11 @@ require "formula"
|
|||||||
|
|
||||||
class FormulaSpecSelectionTests < Homebrew::TestCase
|
class FormulaSpecSelectionTests < Homebrew::TestCase
|
||||||
def test_selects_stable_by_default
|
def test_selects_stable_by_default
|
||||||
f = formula {
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
devel { url "foo-1.1a" }
|
devel { url "foo-1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :stable?
|
assert_predicate f, :stable?
|
||||||
end
|
end
|
||||||
@ -18,10 +18,10 @@ class FormulaSpecSelectionTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_selects_devel_before_head
|
def test_selects_devel_before_head
|
||||||
f = formula {
|
f = formula do
|
||||||
devel { url "foo-1.1a" }
|
devel { url "foo-1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :devel?
|
assert_predicate f, :devel?
|
||||||
end
|
end
|
||||||
@ -37,62 +37,62 @@ class FormulaSpecSelectionTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_incomplete_spec_not_selected
|
def test_incomplete_spec_not_selected
|
||||||
f = formula {
|
f = formula do
|
||||||
sha256 TEST_SHA256
|
sha256 TEST_SHA256
|
||||||
version "1.0"
|
version "1.0"
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :head?
|
assert_predicate f, :head?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_incomplete_stable_not_set
|
def test_incomplete_stable_not_set
|
||||||
f = formula {
|
f = formula do
|
||||||
sha256 TEST_SHA256
|
sha256 TEST_SHA256
|
||||||
devel { url "foo-1.1a" }
|
devel { url "foo-1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_nil f.stable
|
assert_nil f.stable
|
||||||
assert_predicate f, :devel?
|
assert_predicate f, :devel?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_selects_head_when_requested
|
def test_selects_head_when_requested
|
||||||
f = formula("test", Pathname.new(__FILE__).expand_path, :head) {
|
f = formula("test", Pathname.new(__FILE__).expand_path, :head) do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
devel { url "foo-1.1a" }
|
devel { url "foo-1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :head?
|
assert_predicate f, :head?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_selects_devel_when_requested
|
def test_selects_devel_when_requested
|
||||||
f = formula("test", Pathname.new(__FILE__).expand_path, :devel) {
|
f = formula("test", Pathname.new(__FILE__).expand_path, :devel) do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
devel { url "foo-1.1a" }
|
devel { url "foo-1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :devel?
|
assert_predicate f, :devel?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_incomplete_devel_not_set
|
def test_incomplete_devel_not_set
|
||||||
f = formula {
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
devel { version "1.1a" }
|
devel { version "1.1a" }
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_nil f.devel
|
assert_nil f.devel
|
||||||
assert_predicate f, :stable?
|
assert_predicate f, :stable?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_does_not_raise_for_missing_spec
|
def test_does_not_raise_for_missing_spec
|
||||||
f = formula("test", Pathname.new(__FILE__).expand_path, :devel) {
|
f = formula("test", Pathname.new(__FILE__).expand_path, :devel) do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
head "foo"
|
head "foo"
|
||||||
}
|
end
|
||||||
|
|
||||||
assert_predicate f, :stable?
|
assert_predicate f, :stable?
|
||||||
end
|
end
|
||||||
|
|||||||
@ -131,7 +131,7 @@ class FormularyTapFactoryTest < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_factory_tap_formula
|
def test_factory_tap_formula
|
||||||
assert_kind_of Formula, Formulary.factory("#{@name}")
|
assert_kind_of Formula, Formulary.factory(@name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_factory_tap_alias
|
def test_factory_tap_alias
|
||||||
|
|||||||
@ -194,8 +194,8 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_env
|
def test_env
|
||||||
assert_match %r{CMAKE_PREFIX_PATH="#{HOMEBREW_PREFIX}[:"]},
|
assert_match(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/,
|
||||||
cmd("--env")
|
cmd("--env"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_prefix_formula
|
def test_prefix_formula
|
||||||
|
|||||||
@ -154,7 +154,7 @@ class LinkTests < Homebrew::TestCase
|
|||||||
refute_predicate HOMEBREW_PREFIX/"lib/foo", :directory?
|
refute_predicate HOMEBREW_PREFIX/"lib/foo", :directory?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unlink_ignores_DS_Store_when_pruning_empty_dirs
|
def test_unlink_ignores_ds_store_when_pruning_empty_dirs
|
||||||
mkpath HOMEBREW_PREFIX/"lib/foo/bar"
|
mkpath HOMEBREW_PREFIX/"lib/foo/bar"
|
||||||
touch HOMEBREW_PREFIX/"lib/foo/.DS_Store"
|
touch HOMEBREW_PREFIX/"lib/foo/.DS_Store"
|
||||||
mkpath @keg/"lib/foo/bar"
|
mkpath @keg/"lib/foo/bar"
|
||||||
|
|||||||
@ -5,15 +5,13 @@ require "tab"
|
|||||||
require "keg"
|
require "keg"
|
||||||
|
|
||||||
class Formula
|
class Formula
|
||||||
def set_oldname(oldname)
|
attr_writer :oldname
|
||||||
@oldname = oldname
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class MigratorErrorsTests < Homebrew::TestCase
|
class MigratorErrorsTests < Homebrew::TestCase
|
||||||
def setup
|
def setup
|
||||||
@new_f = Testball.new("newname")
|
@new_f = Testball.new("newname")
|
||||||
@new_f.set_oldname "oldname"
|
@new_f.oldname = "oldname"
|
||||||
@old_f = Testball.new("oldname")
|
@old_f = Testball.new("oldname")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ class MigratorTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
@new_f = Testball.new("newname")
|
@new_f = Testball.new("newname")
|
||||||
@new_f.set_oldname "oldname"
|
@new_f.oldname = "oldname"
|
||||||
|
|
||||||
@old_f = Testball.new("oldname")
|
@old_f = Testball.new("oldname")
|
||||||
|
|
||||||
|
|||||||
@ -21,13 +21,13 @@ class PatchTests < Homebrew::TestCase
|
|||||||
assert_equal :p1, patch.strip
|
assert_equal :p1, patch.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_DATA
|
def test_create_data
|
||||||
patch = Patch.create(:p0, :DATA)
|
patch = Patch.create(:p0, :DATA)
|
||||||
assert_kind_of DATAPatch, patch
|
assert_kind_of DATAPatch, patch
|
||||||
assert_equal :p0, patch.strip
|
assert_equal :p0, patch.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_DATA_without_strip
|
def test_create_data_without_strip
|
||||||
patch = Patch.create(:DATA, nil)
|
patch = Patch.create(:DATA, nil)
|
||||||
assert_kind_of DATAPatch, patch
|
assert_kind_of DATAPatch, patch
|
||||||
assert_equal :p1, patch.strip
|
assert_equal :p1, patch.strip
|
||||||
@ -112,7 +112,6 @@ end
|
|||||||
class ExternalPatchTests < Homebrew::TestCase
|
class ExternalPatchTests < Homebrew::TestCase
|
||||||
def setup
|
def setup
|
||||||
@p = ExternalPatch.new(:p1) { url "file:///my.patch" }
|
@p = ExternalPatch.new(:p1) { url "file:///my.patch" }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_url
|
def test_url
|
||||||
|
|||||||
@ -2,15 +2,15 @@ require "testing_env"
|
|||||||
require "formula"
|
require "formula"
|
||||||
|
|
||||||
class PatchingTests < Homebrew::TestCase
|
class PatchingTests < Homebrew::TestCase
|
||||||
TESTBALL_URL = "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz"
|
TESTBALL_URL = "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz".freeze
|
||||||
TESTBALL_PATCHES_URL = "file://#{TEST_DIRECTORY}/tarballs/testball-0.1-patches.tgz"
|
TESTBALL_PATCHES_URL = "file://#{TEST_DIRECTORY}/tarballs/testball-0.1-patches.tgz".freeze
|
||||||
PATCH_URL_A = "file://#{TEST_DIRECTORY}/patches/noop-a.diff"
|
PATCH_URL_A = "file://#{TEST_DIRECTORY}/patches/noop-a.diff".freeze
|
||||||
PATCH_URL_B = "file://#{TEST_DIRECTORY}/patches/noop-b.diff"
|
PATCH_URL_B = "file://#{TEST_DIRECTORY}/patches/noop-b.diff".freeze
|
||||||
PATCH_A_CONTENTS = File.read "#{TEST_DIRECTORY}/patches/noop-a.diff"
|
PATCH_A_CONTENTS = File.read "#{TEST_DIRECTORY}/patches/noop-a.diff"
|
||||||
PATCH_B_CONTENTS = File.read "#{TEST_DIRECTORY}/patches/noop-b.diff"
|
PATCH_B_CONTENTS = File.read "#{TEST_DIRECTORY}/patches/noop-b.diff"
|
||||||
APPLY_A = "noop-a.diff"
|
APPLY_A = "noop-a.diff".freeze
|
||||||
APPLY_B = "noop-b.diff"
|
APPLY_B = "noop-b.diff".freeze
|
||||||
APPLY_C = "noop-c.diff"
|
APPLY_C = "noop-c.diff".freeze
|
||||||
|
|
||||||
def formula(*args, &block)
|
def formula(*args, &block)
|
||||||
super do
|
super do
|
||||||
@ -157,7 +157,7 @@ class PatchingTests < Homebrew::TestCase
|
|||||||
sha256 TESTBALL_PATCHES_SHA256
|
sha256 TESTBALL_PATCHES_SHA256
|
||||||
apply APPLY_B
|
apply APPLY_B
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_patch_p0
|
def test_patch_p0
|
||||||
@ -200,7 +200,7 @@ class PatchingTests < Homebrew::TestCase
|
|||||||
assert_patched formula { patch :p0, PATCH_B_CONTENTS }
|
assert_patched formula { patch :p0, PATCH_B_CONTENTS }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_patch_DATA_constant
|
def test_patch_data_constant
|
||||||
assert_patched formula("test", Pathname.new(__FILE__).expand_path) {
|
assert_patched formula("test", Pathname.new(__FILE__).expand_path) {
|
||||||
def patches
|
def patches
|
||||||
:DATA
|
:DATA
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class PathnameTests < Homebrew::TestCase
|
|||||||
refute_predicate @dir, :exist?
|
refute_predicate @dir, :exist?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rmdir_if_possible_ignore_DS_Store
|
def test_rmdir_if_possible_ignore_ds_store
|
||||||
mkdir_p @dir
|
mkdir_p @dir
|
||||||
touch @dir/".DS_Store"
|
touch @dir/".DS_Store"
|
||||||
assert @dir.rmdir_if_possible
|
assert @dir.rmdir_if_possible
|
||||||
|
|||||||
@ -158,7 +158,7 @@ class BottleSpecificationTests < Homebrew::TestCase
|
|||||||
:snow_leopard_32 => "deadbeef"*8,
|
:snow_leopard_32 => "deadbeef"*8,
|
||||||
:snow_leopard => "faceb00c"*8,
|
:snow_leopard => "faceb00c"*8,
|
||||||
:lion => "baadf00d"*8,
|
:lion => "baadf00d"*8,
|
||||||
:mountain_lion => "8badf00d"*8
|
:mountain_lion => "8badf00d"*8,
|
||||||
}
|
}
|
||||||
|
|
||||||
checksums.each_pair do |cat, digest|
|
checksums.each_pair do |cat, digest|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class TabTests < Homebrew::TestCase
|
|||||||
"source" => {
|
"source" => {
|
||||||
"tap" => "homebrew/core",
|
"tap" => "homebrew/core",
|
||||||
"path" => nil,
|
"path" => nil,
|
||||||
"spec" => "stable"
|
"spec" => "stable",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ class TapTest < Homebrew::TestCase
|
|||||||
|
|
||||||
assert_equal "e1893a6bd191ba895c71b652ff8376a6114c7fa7", @tap.git_head
|
assert_equal "e1893a6bd191ba895c71b652ff8376a6114c7fa7", @tap.git_head
|
||||||
assert_equal "e189", @tap.git_short_head
|
assert_equal "e189", @tap.git_short_head
|
||||||
assert_match %r{years ago}, @tap.git_last_commit
|
assert_match "years ago", @tap.git_last_commit
|
||||||
assert_equal "2009-05-21", @tap.git_last_commit_date
|
assert_equal "2009-05-21", @tap.git_last_commit_date
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ class TapTest < Homebrew::TestCase
|
|||||||
setup_git_repo
|
setup_git_repo
|
||||||
already_tapped_tap = Tap.new("Homebrew", "foo")
|
already_tapped_tap = Tap.new("Homebrew", "foo")
|
||||||
assert_equal true, already_tapped_tap.installed?
|
assert_equal true, already_tapped_tap.installed?
|
||||||
right_remote = "#{@tap.remote}"
|
right_remote = @tap.remote
|
||||||
assert_raises(TapAlreadyTappedError) { already_tapped_tap.install :clone_target => right_remote }
|
assert_raises(TapAlreadyTappedError) { already_tapped_tap.install :clone_target => right_remote }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class ReportTests < Homebrew::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_update_report_without_revision_var
|
def test_update_report_without_revision_var
|
||||||
ENV.delete_if { |k,v| k.start_with? "HOMEBREW_UPDATE" }
|
ENV.delete_if { |k, _v| k.start_with? "HOMEBREW_UPDATE" }
|
||||||
assert_raises(Reporter::ReporterRevisionUnsetError) { Reporter.new(@tap) }
|
assert_raises(Reporter::ReporterRevisionUnsetError) { Reporter.new(@tap) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class VersionComparisonTests < Homebrew::TestCase
|
|||||||
assert_operator version("1.2.3"), :<, version("1.2.3-p34")
|
assert_operator version("1.2.3"), :<, version("1.2.3-p34")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_HEAD
|
def test_head
|
||||||
assert_operator version("HEAD"), :>, version("1.2.3")
|
assert_operator version("HEAD"), :>, version("1.2.3")
|
||||||
assert_operator version("HEAD-abcdef"), :>, version("1.2.3")
|
assert_operator version("HEAD-abcdef"), :>, version("1.2.3")
|
||||||
assert_operator version("1.2.3"), :<, version("HEAD")
|
assert_operator version("1.2.3"), :<, version("HEAD")
|
||||||
@ -448,7 +448,7 @@ class VersionParsingTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_from_url
|
def test_from_url
|
||||||
assert_version_detected "1.2.3",
|
assert_version_detected "1.2.3",
|
||||||
"http://github.com/foo/bar.git", {:tag => "v1.2.3"}
|
"http://github.com/foo/bar.git", :tag => "v1.2.3"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ module Homebrew
|
|||||||
assert_equal Version.create(expected), actual
|
assert_equal Version.create(expected), actual
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_version_detected(expected, url, specs={})
|
def assert_version_detected(expected, url, specs = {})
|
||||||
assert_equal expected, Version.detect(url, specs).to_s
|
assert_equal expected, Version.detect(url, specs).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -111,9 +111,9 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def refute_eql(exp, act, msg = nil)
|
def refute_eql(exp, act, msg = nil)
|
||||||
msg = message(msg) {
|
msg = message(msg) do
|
||||||
"Expected #{mu_pp(act)} to not be eql to #{mu_pp(exp)}"
|
"Expected #{mu_pp(act)} to not be eql to #{mu_pp(exp)}"
|
||||||
}
|
end
|
||||||
refute exp.eql?(act), msg
|
refute exp.eql?(act), msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user