aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-02-26 19:43:49 +0800
committerXu Cheng2016-04-02 21:51:36 +0800
commitdeea4c82a4e64e746465cd74ea80e9afbedd9a91 (patch)
tree7bc10cf25fcec31e79af9e7ec3ee35a794cbc092 /Library
parent2bb30fc5f0ab4146190e65d017ea0ad4eac40dbf (diff)
downloadbrew-deea4c82a4e64e746465cd74ea80e9afbedd9a91.tar.bz2
fix brew tests
Fix the `brew tests` problem caused by core/formula separation.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/fixtures/receipt.json4
-rw-r--r--Library/Homebrew/test/fixtures/updater_fixture.yaml34
-rw-r--r--Library/Homebrew/test/test_formula.rb2
-rw-r--r--Library/Homebrew/test/test_formulary.rb6
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb7
-rw-r--r--Library/Homebrew/test/test_tab.rb8
-rw-r--r--Library/Homebrew/test/test_tap.rb12
-rw-r--r--Library/Homebrew/test/test_update_report.rb10
-rw-r--r--Library/Homebrew/test/testing_env.rb2
9 files changed, 46 insertions, 39 deletions
diff --git a/Library/Homebrew/test/fixtures/receipt.json b/Library/Homebrew/test/fixtures/receipt.json
index 8a3adc672..d021dda3f 100644
--- a/Library/Homebrew/test/fixtures/receipt.json
+++ b/Library/Homebrew/test/fixtures/receipt.json
@@ -14,8 +14,8 @@
"stdlib": "libcxx",
"compiler": "clang",
"source": {
- "path": "/usr/local/Library/Formula/foo.rb",
- "tap": "Homebrew/homebrew",
+ "path": "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb",
+ "tap": "homebrew/core",
"spec": "stable"
}
}
diff --git a/Library/Homebrew/test/fixtures/updater_fixture.yaml b/Library/Homebrew/test/fixtures/updater_fixture.yaml
index 6f7547570..b978bf5d6 100644
--- a/Library/Homebrew/test/fixtures/updater_fixture.yaml
+++ b/Library/Homebrew/test/fixtures/updater_fixture.yaml
@@ -7,13 +7,13 @@ update_git_diff_output_without_formulae_changes: |
M bin/brew
update_git_diff_output_with_formulae_changes: |
M Library/Contributions/brew_bash_completion.sh
- A Library/Formula/antiword.rb
- A Library/Formula/bash-completion.rb
- A Library/Formula/ddrescue.rb
- A Library/Formula/dict.rb
- A Library/Formula/lua.rb
- M Library/Formula/xar.rb
- M Library/Formula/yajl.rb
+ A Formula/antiword.rb
+ A Formula/bash-completion.rb
+ A Formula/ddrescue.rb
+ A Formula/dict.rb
+ A Formula/lua.rb
+ M Formula/xar.rb
+ M Formula/yajl.rb
M Library/Homebrew/ARGV+yeast.rb
M Library/Homebrew/beer_events.rb
M Library/Homebrew/hardware.rb
@@ -25,23 +25,23 @@ update_git_diff_output_with_formulae_changes: |
M README
M bin/brew
update_git_diff_output_with_removed_formulae: |
- A Library/Formula/flac123.rb
- M Library/Formula/gdal.rb
- M Library/Formula/grass.rb
- M Library/Formula/json_spirit.rb
- A Library/Formula/libbson.rb
- D Library/Formula/libgsasl.rb
+ A Formula/flac123.rb
+ M Formula/gdal.rb
+ M Formula/grass.rb
+ M Formula/json_spirit.rb
+ A Formula/libbson.rb
+ D Formula/libgsasl.rb
update_git_diff_output_with_changed_filetype: |
A Library/ENV/4.3/ant
T Library/ENV/4.3/bsdmake
M Library/ENV/4.3/make
- M Library/Formula/elixir.rb
- A Library/Formula/libbson.rb
- D Library/Formula/libgsasl.rb
+ M Formula/elixir.rb
+ A Formula/libbson.rb
+ D Formula/libgsasl.rb
M Library/Homebrew/cmd/update.rb
M SUPPORTERS.md
update_git_diff_output_with_formula_rename: |
- R100 Library/Formula/cv.rb Library/Formula/progress.rb
+ R100 Formula/cv.rb Formula/progress.rb
update_git_diff_output_with_restructured_tap: |
R100 git.rb Formula/git.rb
R100 lua.rb Formula/lua.rb
diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb
index 07571e78f..7f015f653 100644
--- a/Library/Homebrew/test/test_formula.rb
+++ b/Library/Homebrew/test/test_formula.rb
@@ -202,7 +202,7 @@ class FormulaTests < Homebrew::TestCase
def test_path
name = "foo-bar"
- assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name}.rb"), Formulary.core_path(name)
+ assert_equal Pathname.new("#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/Formula/#{name}.rb"), Formulary.core_path(name)
end
def test_class_specs_are_always_initialized
diff --git a/Library/Homebrew/test/test_formulary.rb b/Library/Homebrew/test/test_formulary.rb
index 48f155fcb..738012c17 100644
--- a/Library/Homebrew/test/test_formulary.rb
+++ b/Library/Homebrew/test/test_formulary.rb
@@ -112,7 +112,7 @@ class FormularyTapFactoryTest < Homebrew::TestCase
end
def teardown
- @tap.path.parent.parent.rmtree
+ @tap.path.rmtree
end
def test_factory_tap_formula
@@ -138,6 +138,8 @@ class FormularyTapFactoryTest < Homebrew::TestCase
another_tap = Tap.new "homebrew", "bar"
(another_tap.path/"#{@name}.rb").write @code
assert_raises(TapFormulaAmbiguityError) { Formulary.factory(@name) }
+ ensure
+ another_tap.path.rmtree
end
end
@@ -158,7 +160,7 @@ class FormularyTapPriorityTest < Homebrew::TestCase
def teardown
@core_path.unlink
- @tap.path.parent.parent.rmtree
+ @tap.path.rmtree
end
def test_find_with_priority_core_formula
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 8a7c85551..d20d1c033 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -217,7 +217,7 @@ class IntegrationCommandTests < Homebrew::TestCase
assert_match "homebrew/foo", cmd("tap")
assert_match "homebrew/versions", cmd("tap", "--list-official")
- assert_match "1 tap", cmd("tap-info")
+ assert_match "2 taps", cmd("tap-info")
assert_match "https://github.com/Homebrew/homebrew-foo", cmd("tap-info", "homebrew/foo")
assert_match "https://github.com/Homebrew/homebrew-foo", cmd("tap-info", "--json=v1", "--installed")
assert_match "Pinned homebrew/foo", cmd("tap-pin", "homebrew/foo")
@@ -228,7 +228,7 @@ class IntegrationCommandTests < Homebrew::TestCase
assert_equal "", cmd("tap", "homebrew/bar", path/".git", "-q", "--full")
assert_match "Untapped", cmd("untap", "homebrew/bar")
ensure
- Tap::TAP_DIRECTORY.rmtree
+ path.rmtree
end
def test_missing
@@ -339,13 +339,12 @@ class IntegrationCommandTests < Homebrew::TestCase
end
def test_tap_readme
- (HOMEBREW_LIBRARY/"Taps").mkpath
assert_match "brew install homebrew/foo/<formula>",
cmd("tap-readme", "foo", "--verbose")
readme = HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/README.md"
assert readme.exist?, "The README should be created"
ensure
- (HOMEBREW_LIBRARY/"Taps").rmtree
+ (HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo").rmtree
end
def test_unpack
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index 91d70e705..91a766f04 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -17,7 +17,7 @@ class TabTests < Homebrew::TestCase
"compiler" => "clang",
"stdlib" => "libcxx",
"source" => {
- "tap" => "Homebrew/homebrew",
+ "tap" => "homebrew/core",
"path" => nil,
"spec" => "stable"
})
@@ -60,7 +60,7 @@ class TabTests < Homebrew::TestCase
def test_other_attributes
assert_equal TEST_SHA1, @tab.HEAD
- assert_equal "Homebrew/homebrew", @tab.tap.name
+ assert_equal "homebrew/core", @tab.tap.name
assert_nil @tab.time
refute_predicate @tab, :built_as_bottle
assert_predicate @tab, :poured_from_bottle
@@ -74,7 +74,7 @@ class TabTests < Homebrew::TestCase
assert_equal @unused.sort, tab.unused_options.sort
refute_predicate tab, :built_as_bottle
assert_predicate tab, :poured_from_bottle
- assert_equal "Homebrew/homebrew", tab.tap.name
+ assert_equal "homebrew/core", tab.tap.name
assert_equal :stable, tab.spec
refute_nil tab.time
assert_equal TEST_SHA1, tab.HEAD
@@ -90,7 +90,7 @@ class TabTests < Homebrew::TestCase
assert_equal @unused.sort, tab.unused_options.sort
refute_predicate tab, :built_as_bottle
assert_predicate tab, :poured_from_bottle
- assert_equal "Homebrew/homebrew", tab.tap.name
+ assert_equal "homebrew/core", tab.tap.name
assert_equal :stable, tab.spec
refute_nil tab.time
assert_equal TEST_SHA1, tab.HEAD
diff --git a/Library/Homebrew/test/test_tap.rb b/Library/Homebrew/test/test_tap.rb
index 18fe8709d..fa0602e94 100644
--- a/Library/Homebrew/test/test_tap.rb
+++ b/Library/Homebrew/test/test_tap.rb
@@ -55,7 +55,7 @@ class TapTest < Homebrew::TestCase
end
def teardown
- Tap::TAP_DIRECTORY.rmtree
+ @path.rmtree
end
def test_fetch
@@ -68,7 +68,7 @@ class TapTest < Homebrew::TestCase
end
def test_names
- assert_equal ["homebrew/foo"], Tap.names
+ assert_equal ["homebrew/core", "homebrew/foo"], Tap.names
end
def test_attributes
@@ -95,6 +95,8 @@ class TapTest < Homebrew::TestCase
(Tap::TAP_DIRECTORY/"someone/homebrew-no-git").mkpath
assert_nil Tap.new("someone", "no-git").issues_url
+ ensure
+ path.parent.rmtree
end
def test_files
@@ -132,6 +134,8 @@ class TapTest < Homebrew::TestCase
end
end
refute_predicate version_tap, :private?
+ ensure
+ version_tap.path.rmtree
end
def test_remote_not_git_repo
@@ -213,8 +217,8 @@ class CoreTapTest < Homebrew::TestCase
def test_attributes
assert_equal "Homebrew", @repo.user
- assert_equal "homebrew", @repo.repo
- assert_equal "Homebrew/homebrew", @repo.name
+ assert_equal "core", @repo.repo
+ assert_equal "homebrew/core", @repo.name
assert_equal [], @repo.command_files
assert_predicate @repo, :installed?
refute_predicate @repo, :pinned?
diff --git a/Library/Homebrew/test/test_update_report.rb b/Library/Homebrew/test/test_update_report.rb
index 35243fa1a..b7cdb454b 100644
--- a/Library/Homebrew/test/test_update_report.rb
+++ b/Library/Homebrew/test/test_update_report.rb
@@ -29,10 +29,6 @@ class ReportTests < Homebrew::TestCase
@hub = ReporterHub.new
end
- def teardown
- FileUtils.rm_rf HOMEBREW_LIBRARY.join("Taps")
- end
-
def perform_update(fixture_name = "")
Formulary.stubs(:factory).returns(stub(:pkg_version => "1.0"))
FormulaVersions.stubs(:new).returns(stub(:formula_at_revision => "2.0"))
@@ -91,6 +87,8 @@ class ReportTests < Homebrew::TestCase
perform_update("update_git_diff_output_with_restructured_tap")
assert_equal %w[foo/bar/git foo/bar/lua], @hub.select_formula(:A)
assert_empty @hub.select_formula(:D)
+ ensure
+ tap.path.parent.rmtree
end
def test_update_homebrew_simulate_homebrew_php_restructuring
@@ -101,6 +99,8 @@ class ReportTests < Homebrew::TestCase
perform_update("update_git_diff_simulate_homebrew_php_restructuring")
assert_empty @hub.select_formula(:A)
assert_equal %w[foo/bar/git foo/bar/lua], @hub.select_formula(:D)
+ ensure
+ tap.path.parent.rmtree
end
def test_update_homebrew_with_tap_formulae_changes
@@ -112,5 +112,7 @@ class ReportTests < Homebrew::TestCase
assert_equal %w[foo/bar/lua], @hub.select_formula(:A)
assert_equal %w[foo/bar/git], @hub.select_formula(:M)
assert_empty @hub.select_formula(:D)
+ ensure
+ tap.path.parent.rmtree
end
end
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 8b76dee2c..b70b6cd6d 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -6,7 +6,7 @@ require "global"
require "formulary"
# Test environment setup
-HOMEBREW_LIBRARY.join("Formula").mkpath
+(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula").mkpath
%w[cache formula_cache cellar logs].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
# Test fixtures and files can be found relative to this path