diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 5453504b08..9353ce5f92 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -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