aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorAlyssa Ross2016-09-27 22:37:03 +0100
committerAlyssa Ross2016-10-25 22:34:34 +0100
commit888c44b238b6a5afa705ca46f6a682ac1c4bb729 (patch)
tree82451d8dda1cc4b2a07236a6281040b6f326be03 /Library/Homebrew/test
parent08c898f28075d04c0e9921d72d9d3791f0dbef8e (diff)
downloadbrew-888c44b238b6a5afa705ca46f6a682ac1c4bb729.tar.bz2
uninstall: fix dependent order bug
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_uninstall.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_uninstall.rb b/Library/Homebrew/test/test_uninstall.rb
index 050934238..fe14a79c2 100644
--- a/Library/Homebrew/test/test_uninstall.rb
+++ b/Library/Homebrew/test/test_uninstall.rb
@@ -1,8 +1,43 @@
require "helper/integration_command_test_case"
class IntegrationCommandTestUninstall < IntegrationCommandTestCase
+ def setup
+ super
+ @f1_path = setup_test_formula "testball_f1", <<-CONTENT
+ def install
+ FileUtils.touch prefix/touch("hello")
+ end
+ CONTENT
+ @f2_path = setup_test_formula "testball_f2", <<-CONTENT
+ depends_on "testball_f1"
+
+ def install
+ FileUtils.touch prefix/touch("hello")
+ end
+ CONTENT
+ end
+
def test_uninstall
cmd("install", testball)
assert_match "Uninstalling testball", cmd("uninstall", "--force", testball)
end
+
+ def test_uninstall_leaving_dependents
+ cmd("install", "testball_f2")
+ assert_match "Refusing to uninstall", cmd_fail("uninstall", "testball_f1")
+ assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
+ cmd("uninstall", "testball_f2")
+ end
+
+ def test_uninstall_dependent_first
+ cmd("install", "testball_f2")
+ assert_match "Uninstalling #{Formulary.factory(@f1_path).rack}",
+ cmd("uninstall", "testball_f2", "testball_f1")
+ end
+
+ def test_uninstall_dependent_last
+ cmd("install", "testball_f2")
+ assert_match "Uninstalling #{Formulary.factory(@f2_path).rack}",
+ cmd("uninstall", "testball_f1", "testball_f2")
+ end
end