aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAndrea Kao2016-07-12 15:22:06 -0700
committerMartin Afanasjew2016-07-13 00:22:06 +0200
commitc8812522a4a0d968767fe9d6f2f44e4c5a280c1f (patch)
treef6e09d0ac9cf3e5986e58cbd8b08584fd9c90935 /Library
parentcdf4f42ab951214fb7fac0781091783552415944 (diff)
downloadbrew-c8812522a4a0d968767fe9d6f2f44e4c5a280c1f.tar.bz2
tests: add cmd/link, cmd/unlink integration tests (#398)
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb31
1 files changed, 29 insertions, 2 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 5453504b0..9353ce5f9 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