Skip to content
Snippets Groups Projects
Commit c8812522 authored by Andrea Kao's avatar Andrea Kao Committed by Martin Afanasjew
Browse files

tests: add cmd/link, cmd/unlink integration tests (#398)

parent cdf4f42a
No related branches found
No related tags found
No related merge requests found
......@@ -110,11 +110,11 @@ class IntegrationCommandTests < Homebrew::TestCase
formula_path = CoreTap.new.formula_dir/"#{name}.rb"
case name
when "testball"
when /^testball/
content = <<-EOS.undent
desc "Some test"
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}"
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`",
cmd("services", "list")
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment