aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-07-04 17:05:37 +0100
committerMike McQuaid2016-07-04 17:05:37 +0100
commitbf42959609280e023b00a9f185bc5a55acd6f453 (patch)
tree73e476242f9a9f2d4c79257b8183548222c80d05 /Library/Homebrew
parentdba1958bd79c1c9d18f215dfc2b806ea62edd1c8 (diff)
downloadbrew-bf42959609280e023b00a9f185bc5a55acd6f453.tar.bz2
Revert "Revert "Test officially supported cmd taps. (#390)""
This reverts commit dba1958bd79c1c9d18f215dfc2b806ea62edd1c8.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/tests.rb14
-rw-r--r--Library/Homebrew/dev-cmd/test-bot.rb1
-rw-r--r--Library/Homebrew/global.rb1
-rw-r--r--Library/Homebrew/official_taps.rb8
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb37
5 files changed, 58 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/tests.rb b/Library/Homebrew/cmd/tests.rb
index ae10f0f7a..2e6bb647b 100644
--- a/Library/Homebrew/cmd/tests.rb
+++ b/Library/Homebrew/cmd/tests.rb
@@ -1,13 +1,23 @@
#: @hide_from_man_page
-#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script/test_method>] [`--seed` <seed>] [`--trace`] [`--online`]:
+#: * `tests` [`-v`] [`--coverage`] [`--generic`] [`--no-compat`] [`--only=`<test_script/test_method>] [`--seed` <seed>] [`--trace`] [`--online`] [`--official-cmd-taps`]:
#: Run Homebrew's unit and integration tests.
require "fileutils"
+require "tap"
module Homebrew
def tests
+ ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
+
+ if ARGV.include? "--official-cmd-taps"
+ ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1"
+ OFFICIAL_CMD_TAPS.each do |tap, _|
+ tap = Tap.fetch tap
+ tap.install unless tap.installed?
+ end
+ end
+
(HOMEBREW_LIBRARY/"Homebrew/test").cd do
- ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
ENV["TESTOPTS"] = "-v" if ARGV.verbose?
ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat"
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic"
diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb
index 2f6c44d3a..9e55fbfa6 100644
--- a/Library/Homebrew/dev-cmd/test-bot.rb
+++ b/Library/Homebrew/dev-cmd/test-bot.rb
@@ -659,6 +659,7 @@ module Homebrew
test "brew", "tests", *tests_args
test "brew", "tests", "--no-compat"
test "brew", "readall", "--syntax"
+ test "brew", "tests", "--official-cmd-taps"
else
test "brew", "readall", "--aliases", @tap.name
end
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 52bee2166..02ff15e39 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -9,6 +9,7 @@ require "utils"
require "exceptions"
require "set"
require "rbconfig"
+require "official_taps"
ARGV.extend(HomebrewArgvExtension)
diff --git a/Library/Homebrew/official_taps.rb b/Library/Homebrew/official_taps.rb
index 75ad096c7..aedb0809e 100644
--- a/Library/Homebrew/official_taps.rb
+++ b/Library/Homebrew/official_taps.rb
@@ -15,4 +15,10 @@ OFFICIAL_TAPS = %w[
tex
versions
x11
-]
+].freeze
+
+OFFICIAL_CMD_TAPS = {
+ "caskroom/cask" => ["cask"],
+ "homebrew/bundle" => ["bundle"],
+ "homebrew/services" => ["services"],
+}.freeze
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index cc8f3b458..9b37fa545 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -17,6 +17,12 @@ class IntegrationCommandTests < Homebrew::TestCase
@formula_files.each(&:unlink)
end
+ def needs_test_cmd_taps
+ unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"]
+ skip "HOMEBREW_TEST_OFFICIAL_CMD_TAPS is not set"
+ end
+ end
+
def cmd_id_from_args(args)
args_pretty = args.join(" ").gsub(TEST_TMPDIR, "@TMPDIR@")
test_pretty = "#{self.class.name}\##{name}.#{@cmd_id_index += 1}"
@@ -668,4 +674,35 @@ class IntegrationCommandTests < Homebrew::TestCase
ensure
desc_cache.unlink
end
+
+ def test_bundle
+ needs_test_cmd_taps
+ HOMEBREW_REPOSITORY.cd do
+ shutup do
+ system "git", "init"
+ system "git", "commit", "--allow-empty", "-m", "This is a test commit"
+ end
+ end
+
+ mktmpdir do |path|
+ FileUtils.touch "#{path}/Brewfile"
+ Dir.chdir path do
+ assert_equal "The Brewfile's dependencies are satisfied.",
+ cmd("bundle", "check")
+ end
+ end
+ ensure
+ FileUtils.rm_rf HOMEBREW_REPOSITORY/".git"
+ end
+
+ def test_cask
+ needs_test_cmd_taps
+ assert_equal "Warning: nothing to list", cmd("cask", "list")
+ end
+
+ def test_services
+ needs_test_cmd_taps
+ assert_equal "Warning: No services available to control with `brew services`",
+ cmd("services", "list")
+ end
end