tests: add cmd/link, cmd/unlink integration tests (#398)
This commit is contained in:
parent
cdf4f42ab9
commit
c8812522a4
@ -110,11 +110,11 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
formula_path = CoreTap.new.formula_dir/"#{name}.rb"
|
formula_path = CoreTap.new.formula_dir/"#{name}.rb"
|
||||||
|
|
||||||
case name
|
case name
|
||||||
when "testball"
|
when /^testball/
|
||||||
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/#{name}-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"
|
||||||
@ -665,4 +665,31 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
assert_equal "Warning: No services available to control with `brew services`",
|
assert_equal "Warning: No services available to control with `brew services`",
|
||||||
cmd("services", "list")
|
cmd("services", "list")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_link
|
||||||
|
assert_match "This command requires a keg argument", cmd_fail("link")
|
||||||
|
|
||||||
|
setup_test_formula "testball1"
|
||||||
|
cmd("install", "testball1")
|
||||||
|
cmd("link", "testball1")
|
||||||
|
|
||||||
|
cmd("unlink", "testball1")
|
||||||
|
assert_match "Would link", cmd("link", "--dry-run", "testball1")
|
||||||
|
assert_match "Would remove",
|
||||||
|
cmd("link", "--dry-run", "--overwrite", "testball1")
|
||||||
|
assert_match "Linking", cmd("link", "testball1")
|
||||||
|
|
||||||
|
setup_test_formula "testball2", <<-EOS.undent
|
||||||
|
keg_only "just because"
|
||||||
|
EOS
|
||||||
|
cmd("install", "testball2")
|
||||||
|
assert_match "testball2 is keg-only", cmd("link", "testball2")
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_unlink
|
||||||
|
setup_test_formula "testball"
|
||||||
|
|
||||||
|
cmd("install", "testball")
|
||||||
|
assert_match "Would remove", cmd("unlink", "--dry-run", "testball")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user