Rename/merge test files.

This commit is contained in:
Markus Reiter 2016-09-27 00:03:40 +02:00
parent cd677cf3ae
commit d508b124a4
76 changed files with 231 additions and 243 deletions

View File

@ -4,7 +4,7 @@ require "fileutils"
require "pathname" require "pathname"
require "formula" require "formula"
class IntegrationCommandTests < Homebrew::TestCase class IntegrationCommandTestCase < Homebrew::TestCase
def setup def setup
@cmd_id_index = 0 # Assign unique IDs to invocations of `cmd_output`. @cmd_id_index = 0 # Assign unique IDs to invocations of `cmd_output`.
(HOMEBREW_PREFIX/"bin").mkpath (HOMEBREW_PREFIX/"bin").mkpath
@ -120,7 +120,7 @@ class IntegrationCommandTests < Homebrew::TestCase
content = <<-EOS.undent content = <<-EOS.undent
desc "Some test" desc "Some test"
homepage "https://example.com/#{name}" homepage "https://example.com/#{name}"
url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" url "file://#{File.expand_path("../..", __FILE__)}/tarballs/testball-0.1.tbz"
sha256 "#{TESTBALL_SHA256}" sha256 "#{TESTBALL_SHA256}"
option "with-foo", "Build with foo" option "with-foo", "Build with foo"
@ -189,6 +189,6 @@ class IntegrationCommandTests < Homebrew::TestCase
end end
def testball def testball
"#{File.expand_path("..", __FILE__)}/testball.rb" "#{File.expand_path("../..", __FILE__)}/testball.rb"
end end
end end

View File

@ -1,5 +1,33 @@
require "testing_env" require "testing_env"
require "extend/ENV" require "extend/ENV"
require "helper/integration_command_test_case"
class IntegrationCommandTestEnv < IntegrationCommandTestCase
def test_env
assert_match(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/,
cmd("--env"))
end
def test_env_fish
assert_match(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
cmd("--env", "--shell=fish"))
end
def test_env_csh
assert_match(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/,
cmd("--env", "--shell=tcsh"))
end
def test_env_bash
assert_match(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
cmd("--env", "--shell=bash"))
end
def test_env_plain
assert_match(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/,
cmd("--env", "--plain"))
end
end
module SharedEnvTests module SharedEnvTests
def setup def setup

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestAnalytics < IntegrationCommandTests class IntegrationCommandTestAnalytics < IntegrationCommandTestCase
def test_analytics def test_analytics
HOMEBREW_REPOSITORY.cd do HOMEBREW_REPOSITORY.cd do
shutup do shutup do

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestBottle < IntegrationCommandTests class IntegrationCommandTestBottle < IntegrationCommandTestCase
def test_bottle def test_bottle
cmd("install", "--build-bottle", testball) cmd("install", "--build-bottle", testball)
assert_match "Formula not from core or any taps", assert_match "Formula not from core or any taps",

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestBundle < IntegrationCommandTests class IntegrationCommandTestBundle < IntegrationCommandTestCase
def test_bundle def test_bundle
needs_test_cmd_taps needs_test_cmd_taps
setup_remote_tap("homebrew/bundle") setup_remote_tap("homebrew/bundle")

View File

@ -0,0 +1,8 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestCache < IntegrationCommandTestCase
def test_cache
assert_equal HOMEBREW_CACHE.to_s,
cmd("--cache")
end
end

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCacheFormula < IntegrationCommandTests class IntegrationCommandTestCacheFormula < IntegrationCommandTestCase
def test_cache_formula def test_cache_formula
assert_match %r{#{HOMEBREW_CACHE}/testball-}, assert_match %r{#{HOMEBREW_CACHE}/testball-},
cmd("--cache", testball) cmd("--cache", testball)

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCask < IntegrationCommandTests class IntegrationCommandTestCask < IntegrationCommandTestCase
def test_cask def test_cask
needs_test_cmd_taps needs_test_cmd_taps
needs_macos needs_macos

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCat < IntegrationCommandTests class IntegrationCommandTestCat < IntegrationCommandTestCase
def test_cat def test_cat
formula_file = setup_test_formula "testball" formula_file = setup_test_formula "testball"
assert_equal formula_file.read.chomp, cmd("cat", "testball") assert_equal formula_file.read.chomp, cmd("cat", "testball")

View File

@ -0,0 +1,8 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestCellar < IntegrationCommandTestCase
def test_cellar
assert_equal HOMEBREW_CELLAR.to_s,
cmd("--cellar")
end
end

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCellarFormula < IntegrationCommandTests class IntegrationCommandTestCellarFormula < IntegrationCommandTestCase
def test_cellar_formula def test_cellar_formula
assert_match "#{HOMEBREW_CELLAR}/testball", assert_match "#{HOMEBREW_CELLAR}/testball",
cmd("--cellar", testball) cmd("--cellar", testball)

View File

@ -3,6 +3,14 @@ require "testball"
require "cleanup" require "cleanup"
require "fileutils" require "fileutils"
require "pathname" require "pathname"
require "helper/integration_command_test_case"
class IntegrationCommandTestCleanup < IntegrationCommandTestCase
def test_cleanup
(HOMEBREW_CACHE/"test").write "test"
assert_match "#{HOMEBREW_CACHE}/test", cmd("cleanup", "--prune=all")
end
end
class CleanupTests < Homebrew::TestCase class CleanupTests < Homebrew::TestCase
def setup def setup

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCommand < IntegrationCommandTests class IntegrationCommandTestCommand < IntegrationCommandTestCase
def test_command def test_command
assert_equal "#{HOMEBREW_LIBRARY_PATH}/cmd/info.rb", assert_equal "#{HOMEBREW_LIBRARY_PATH}/cmd/info.rb",
cmd("command", "info") cmd("command", "info")

View File

@ -2,6 +2,14 @@ require "testing_env"
require "cmd/command" require "cmd/command"
require "cmd/commands" require "cmd/commands"
require "fileutils" require "fileutils"
require "helper/integration_command_test_case"
class IntegrationCommandTestCommands < IntegrationCommandTestCase
def test_commands
assert_match "Built-in commands",
cmd("commands")
end
end
class CommandsTests < Homebrew::TestCase class CommandsTests < Homebrew::TestCase
def setup def setup

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestConfig < IntegrationCommandTests class IntegrationCommandTestConfig < IntegrationCommandTestCase
def test_config def test_config
assert_match "HOMEBREW_VERSION: #{HOMEBREW_VERSION}", assert_match "HOMEBREW_VERSION: #{HOMEBREW_VERSION}",
cmd("config") cmd("config")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCreate < IntegrationCommandTests class IntegrationCommandTestCreate < IntegrationCommandTestCase
def test_create def test_create
url = "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" url = "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz"
cmd("create", url, "HOMEBREW_EDITOR" => "/bin/cat") cmd("create", url, "HOMEBREW_EDITOR" => "/bin/cat")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestCustomCommand < IntegrationCommandTests class IntegrationCommandTestCustomCommand < IntegrationCommandTestCase
def test_custom_command def test_custom_command
mktmpdir do |path| mktmpdir do |path|
cmd = "int-test-#{rand}" cmd = "int-test-#{rand}"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestDeps < IntegrationCommandTests class IntegrationCommandTestDeps < IntegrationCommandTestCase
def test_deps def test_deps
setup_test_formula "foo" setup_test_formula "foo"
setup_test_formula "bar" setup_test_formula "bar"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestDesc < IntegrationCommandTests class IntegrationCommandTestDesc < IntegrationCommandTestCase
def test_desc def test_desc
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestDoctor < IntegrationCommandTests class IntegrationCommandTestDoctor < IntegrationCommandTestCase
def test_doctor def test_doctor
assert_match "This is an integration test", assert_match "This is an integration test",
cmd_fail("doctor", "check_integration_test") cmd_fail("doctor", "check_integration_test")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestEdit < IntegrationCommandTests class IntegrationCommandTestEdit < IntegrationCommandTestCase
def test_edit def test_edit
(HOMEBREW_REPOSITORY/".git").mkpath (HOMEBREW_REPOSITORY/".git").mkpath
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestFetch < IntegrationCommandTests class IntegrationCommandTestFetch < IntegrationCommandTestCase
def test_fetch def test_fetch
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestHelp < IntegrationCommandTests class IntegrationCommandTestHelp < IntegrationCommandTestCase
def test_help def test_help
assert_match "Example usage:\n", assert_match "Example usage:\n",
cmd_fail # Generic help (empty argument list). cmd_fail # Generic help (empty argument list).

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestHome < IntegrationCommandTests class IntegrationCommandTestHome < IntegrationCommandTestCase
def test_home def test_home
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,16 @@
require "testing_env" require "testing_env"
require "cmd/info" require "cmd/info"
require "formula" require "formula"
require "helper/integration_command_test_case"
class IntegrationCommandTestInfo < IntegrationCommandTestCase
def test_info
setup_test_formula "testball"
assert_match "testball: stable 0.1",
cmd("info", "testball")
end
end
class InfoCommandTests < Homebrew::TestCase class InfoCommandTests < Homebrew::TestCase
def test_github_remote_path def test_github_remote_path

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestInstall < IntegrationCommandTests class IntegrationCommandTestInstall < IntegrationCommandTestCase
def test_install def test_install
setup_test_formula "testball1" setup_test_formula "testball1"
assert_match "Specify `--HEAD`", cmd_fail("install", "testball1", "--head") assert_match "Specify `--HEAD`", cmd_fail("install", "testball1", "--head")

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestCache < IntegrationCommandTests
def test_cache
assert_equal HOMEBREW_CACHE.to_s,
cmd("--cache")
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestCellar < IntegrationCommandTests
def test_cellar
assert_equal HOMEBREW_CELLAR.to_s,
cmd("--cellar")
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestCleanup < IntegrationCommandTests
def test_cleanup
(HOMEBREW_CACHE/"test").write "test"
assert_match "#{HOMEBREW_CACHE}/test", cmd("cleanup", "--prune=all")
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestCommands < IntegrationCommandTests
def test_commands
assert_match "Built-in commands",
cmd("commands")
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestEnv < IntegrationCommandTests
def test_env
assert_match(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/,
cmd("--env"))
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestEnvBash < IntegrationCommandTests
def test_env_bash
assert_match(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
cmd("--env", "--shell=bash"))
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestEnvCsh < IntegrationCommandTests
def test_env_csh
assert_match(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/,
cmd("--env", "--shell=tcsh"))
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestEnvFish < IntegrationCommandTests
def test_env_fish
assert_match(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
cmd("--env", "--shell=fish"))
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestEnvPlain < IntegrationCommandTests
def test_env_plain
assert_match(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/,
cmd("--env", "--plain"))
end
end

View File

@ -1,10 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestInfo < IntegrationCommandTests
def test_info
setup_test_formula "testball"
assert_match "testball: stable 0.1",
cmd("info", "testball")
end
end

View File

@ -1,12 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestOptions < IntegrationCommandTests
def test_options
setup_test_formula "testball", <<-EOS.undent
depends_on "bar" => :recommended
EOS
assert_equal "--with-foo\n\tBuild with foo\n--without-bar\n\tBuild without bar support",
cmd_output("options", "testball").chomp
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestPrefix < IntegrationCommandTests
def test_prefix
assert_equal HOMEBREW_PREFIX.to_s,
cmd("--prefix")
end
end

View File

@ -1,30 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestTap < IntegrationCommandTests
def test_tap
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
path.mkpath
path.cd do
shutup do
system "git", "init"
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
FileUtils.touch "readme"
system "git", "add", "--all"
system "git", "commit", "-m", "init"
end
end
assert_match "homebrew/foo", cmd("tap")
assert_match "homebrew/versions", cmd("tap", "--list-official")
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")
assert_match "homebrew/foo", cmd("tap", "--list-pinned")
assert_match "Unpinned homebrew/foo", cmd("tap-unpin", "homebrew/foo")
assert_match "Tapped", cmd("tap", "homebrew/bar", path/".git")
assert_match "Untapped", cmd("untap", "homebrew/bar")
assert_equal "", cmd("tap", "homebrew/bar", path/".git", "-q", "--full")
assert_match "Untapped", cmd("untap", "homebrew/bar")
end
end

View File

@ -1,8 +0,0 @@
require "integration_cmds_tests"
class IntegrationCommandTestVersion < IntegrationCommandTests
def test_version
assert_match HOMEBREW_VERSION.to_s,
cmd("--version")
end
end

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestIrb < IntegrationCommandTests class IntegrationCommandTestIrb < IntegrationCommandTestCase
def test_irb def test_irb
assert_match "'v8'.f # => instance of the v8 formula", assert_match "'v8'.f # => instance of the v8 formula",
cmd("irb", "--examples") cmd("irb", "--examples")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestLeaves < IntegrationCommandTests class IntegrationCommandTestLeaves < IntegrationCommandTestCase
def test_leaves def test_leaves
setup_test_formula "foo" setup_test_formula "foo"
setup_test_formula "bar" setup_test_formula "bar"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestLink < IntegrationCommandTests class IntegrationCommandTestLink < IntegrationCommandTestCase
def test_link def test_link
assert_match "This command requires a keg argument", cmd_fail("link") assert_match "This command requires a keg argument", cmd_fail("link")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestLinkapps < IntegrationCommandTests class IntegrationCommandTestLinkapps < IntegrationCommandTestCase
def test_linkapps def test_linkapps
home_dir = Pathname.new(mktmpdir) home_dir = Pathname.new(mktmpdir)
(home_dir/"Applications").mkpath (home_dir/"Applications").mkpath

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestList < IntegrationCommandTests class IntegrationCommandTestList < IntegrationCommandTestCase
def test_list def test_list
formulae = %w[bar foo qux] formulae = %w[bar foo qux]
formulae.each do |f| formulae.each do |f|

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestLog < IntegrationCommandTests class IntegrationCommandTestLog < IntegrationCommandTestCase
def test_log def test_log
FileUtils.cd HOMEBREW_REPOSITORY do FileUtils.cd HOMEBREW_REPOSITORY do
shutup do shutup do

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestLogFormula < IntegrationCommandTests class IntegrationCommandTestLogFormula < IntegrationCommandTestCase
def test_log_formula def test_log_formula
core_tap = CoreTap.new core_tap = CoreTap.new
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestMigrate < IntegrationCommandTests class IntegrationCommandTestMigrate < IntegrationCommandTestCase
def test_migrate def test_migrate
setup_test_formula "testball1" setup_test_formula "testball1"
setup_test_formula "testball2" setup_test_formula "testball2"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestMissing < IntegrationCommandTests class IntegrationCommandTestMissing < IntegrationCommandTestCase
def test_missing def test_missing
setup_test_formula "foo" setup_test_formula "foo"
setup_test_formula "bar" setup_test_formula "bar"

View File

@ -1,5 +1,17 @@
require "testing_env" require "testing_env"
require "options" require "options"
require "helper/integration_command_test_case"
class IntegrationCommandTestOptions < IntegrationCommandTestCase
def test_options
setup_test_formula "testball", <<-EOS.undent
depends_on "bar" => :recommended
EOS
assert_equal "--with-foo\n\tBuild with foo\n--without-bar\n\tBuild without bar support",
cmd_output("options", "testball").chomp
end
end
class OptionTests < Homebrew::TestCase class OptionTests < Homebrew::TestCase
def setup def setup

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestOutdated < IntegrationCommandTests class IntegrationCommandTestOutdated < IntegrationCommandTestCase
def test_outdated def test_outdated
setup_test_formula "testball" setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestPinUnpin < IntegrationCommandTests class IntegrationCommandTestPinUnpin < IntegrationCommandTestCase
def test_pin_unpin def test_pin_unpin
setup_test_formula "testball" setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath

View File

@ -0,0 +1,8 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestPrefix < IntegrationCommandTestCase
def test_prefix
assert_equal HOMEBREW_PREFIX.to_s,
cmd("--prefix")
end
end

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestPrefixFormula < IntegrationCommandTests class IntegrationCommandTestPrefixFormula < IntegrationCommandTestCase
def test_prefix_formula def test_prefix_formula
assert_match "#{HOMEBREW_CELLAR}/testball", assert_match "#{HOMEBREW_CELLAR}/testball",
cmd("--prefix", testball) cmd("--prefix", testball)

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestPrune < IntegrationCommandTests class IntegrationCommandTestPrune < IntegrationCommandTestCase
def test_prune def test_prune
share = (HOMEBREW_PREFIX/"share") share = (HOMEBREW_PREFIX/"share")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestPull < IntegrationCommandTests class IntegrationCommandTestPull < IntegrationCommandTestCase
def test_pull def test_pull
skip "Requires network connection" if ENV["HOMEBREW_NO_GITHUB_API"] skip "Requires network connection" if ENV["HOMEBREW_NO_GITHUB_API"]

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestPullOffline < IntegrationCommandTests class IntegrationCommandTestPullOffline < IntegrationCommandTestCase
def test_pull_offline def test_pull_offline
assert_match "You meant `git pull --rebase`.", cmd_fail("pull", "--rebase") assert_match "You meant `git pull --rebase`.", cmd_fail("pull", "--rebase")
assert_match "This command requires at least one argument", cmd_fail("pull") assert_match "This command requires at least one argument", cmd_fail("pull")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestReadall < IntegrationCommandTests class IntegrationCommandTestReadall < IntegrationCommandTestCase
def test_readall def test_readall
formula_file = setup_test_formula "testball" formula_file = setup_test_formula "testball"
alias_file = CoreTap.new.alias_dir/"foobar" alias_file = CoreTap.new.alias_dir/"foobar"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestReinstall < IntegrationCommandTests class IntegrationCommandTestReinstall < IntegrationCommandTestCase
def test_reinstall def test_reinstall
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestReinstallPinned < IntegrationCommandTests class IntegrationCommandTestReinstallPinned < IntegrationCommandTestCase
def test_reinstall_pinned def test_reinstall_pinned
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestRepository < IntegrationCommandTests class IntegrationCommandTestRepository < IntegrationCommandTestCase
def test_repository def test_repository
assert_match HOMEBREW_REPOSITORY.to_s, assert_match HOMEBREW_REPOSITORY.to_s,
cmd("--repository") cmd("--repository")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestSearch < IntegrationCommandTests class IntegrationCommandTestSearch < IntegrationCommandTestCase
def test_search def test_search
setup_test_formula "testball" setup_test_formula "testball"
desc_cache = HOMEBREW_CACHE/"desc_cache.json" desc_cache = HOMEBREW_CACHE/"desc_cache.json"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestServices < IntegrationCommandTests class IntegrationCommandTestServices < IntegrationCommandTestCase
def test_services def test_services
needs_test_cmd_taps needs_test_cmd_taps
needs_macos needs_macos

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestSh < IntegrationCommandTests class IntegrationCommandTestSh < IntegrationCommandTestCase
def test_sh def test_sh
assert_match "Your shell has been configured", assert_match "Your shell has been configured",
cmd("sh", "SHELL" => which("true")) cmd("sh", "SHELL" => which("true"))

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestSwitch < IntegrationCommandTests class IntegrationCommandTestSwitch < IntegrationCommandTestCase
def test_switch def test_switch
assert_match "Usage: brew switch <name> <version>", cmd_fail("switch") assert_match "Usage: brew switch <name> <version>", cmd_fail("switch")
assert_match "testball not found", cmd_fail("switch", "testball", "0.1") assert_match "testball not found", cmd_fail("switch", "testball", "0.1")

View File

@ -1,4 +1,34 @@
require "testing_env" require "testing_env"
require "helper/integration_command_test_case"
class IntegrationCommandTestTap < IntegrationCommandTestCase
def test_tap
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
path.mkpath
path.cd do
shutup do
system "git", "init"
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
FileUtils.touch "readme"
system "git", "add", "--all"
system "git", "commit", "-m", "init"
end
end
assert_match "homebrew/foo", cmd("tap")
assert_match "homebrew/versions", cmd("tap", "--list-official")
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")
assert_match "homebrew/foo", cmd("tap", "--list-pinned")
assert_match "Unpinned homebrew/foo", cmd("tap-unpin", "homebrew/foo")
assert_match "Tapped", cmd("tap", "homebrew/bar", path/".git")
assert_match "Untapped", cmd("untap", "homebrew/bar")
assert_equal "", cmd("tap", "homebrew/bar", path/".git", "-q", "--full")
assert_match "Untapped", cmd("untap", "homebrew/bar")
end
end
class TapTest < Homebrew::TestCase class TapTest < Homebrew::TestCase
include FileUtils include FileUtils

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestTapReadme < IntegrationCommandTests class IntegrationCommandTestTapReadme < IntegrationCommandTestCase
def test_tap_readme def test_tap_readme
assert_match "brew install homebrew/foo/<formula>", assert_match "brew install homebrew/foo/<formula>",
cmd("tap-readme", "foo", "--verbose") cmd("tap-readme", "foo", "--verbose")

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestTestFormula < IntegrationCommandTests class IntegrationCommandTestTestFormula < IntegrationCommandTestCase
def test_test_formula def test_test_formula
assert_match "This command requires a formula argument", cmd_fail("test") assert_match "This command requires a formula argument", cmd_fail("test")
assert_match "Testing requires the latest version of testball", assert_match "Testing requires the latest version of testball",

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUninstall < IntegrationCommandTests class IntegrationCommandTestUninstall < IntegrationCommandTestCase
def test_uninstall def test_uninstall
cmd("install", testball) cmd("install", testball)
assert_match "Uninstalling testball", cmd("uninstall", "--force", testball) assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUnlink < IntegrationCommandTests class IntegrationCommandTestUnlink < IntegrationCommandTestCase
def test_unlink def test_unlink
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUnlinkapps < IntegrationCommandTests class IntegrationCommandTestUnlinkapps < IntegrationCommandTestCase
def test_unlinkapps def test_unlinkapps
home_dir = Pathname.new(mktmpdir) home_dir = Pathname.new(mktmpdir)
apps_dir = home_dir/"Applications" apps_dir = home_dir/"Applications"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUnpack < IntegrationCommandTests class IntegrationCommandTestUnpack < IntegrationCommandTestCase
def test_unpack def test_unpack
setup_test_formula "testball" setup_test_formula "testball"

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUpgrade < IntegrationCommandTests class IntegrationCommandTestUpgrade < IntegrationCommandTestCase
def test_upgrade def test_upgrade
setup_test_formula "testball" setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath (HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath

View File

@ -1,6 +1,6 @@
require "integration_cmds_tests" require "helper/integration_command_test_case"
class IntegrationCommandTestUses < IntegrationCommandTests class IntegrationCommandTestUses < IntegrationCommandTestCase
def test_uses def test_uses
setup_test_formula "foo" setup_test_formula "foo"
setup_test_formula "bar" setup_test_formula "bar"

View File

@ -0,0 +1,8 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestVersion < IntegrationCommandTestCase
def test_version
assert_match HOMEBREW_VERSION.to_s,
cmd("--version")
end
end