aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 5f3a1ddb1..d1bc98a54 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -32,6 +32,7 @@ class IntegrationCommandTests < Homebrew::TestCase
coretap.path/".git",
coretap.alias_dir,
coretap.formula_dir.children,
+ coretap.path/"formula_renames.json",
].flatten
FileUtils.rm_rf paths_to_delete
end
@@ -761,6 +762,45 @@ class IntegrationCommandTests < Homebrew::TestCase
cmd("analytics", "regenerate-uuid")
end
+ def test_migrate
+ setup_test_formula "testball1"
+ setup_test_formula "testball2"
+ assert_match "Invalid usage", cmd_fail("migrate")
+ assert_match "No available formula with the name \"testball\"",
+ cmd_fail("migrate", "testball")
+ assert_match "testball1 doesn't replace any formula",
+ cmd_fail("migrate", "testball1")
+
+ core_tap = CoreTap.new
+ core_tap.path.cd do
+ shutup do
+ system "git", "init"
+ system "git", "add", "--all"
+ system "git", "commit", "-m", "Testball1 has not yet been renamed"
+ end
+ end
+
+ cmd("install", "testball1")
+ (core_tap.path/"Formula/testball1.rb").unlink
+ formula_renames = core_tap.path/"formula_renames.json"
+ formula_renames.write <<-EOS.undent
+ {
+ "testball1": "testball2"
+ }
+ EOS
+
+ core_tap.path.cd do
+ shutup do
+ system "git", "add", "--all"
+ system "git", "commit", "-m", "Testball1 has been renamed to Testball2"
+ end
+ end
+
+ assert_match "Migrating testball1 to testball2", cmd("migrate", "testball1")
+ (HOMEBREW_CELLAR/"testball1").unlink
+ assert_match "Error: No such keg", cmd_fail("migrate", "testball1")
+ end
+
def test_switch
assert_match "Usage: brew switch <name> <version>", cmd_fail("switch")
assert_match "testball not found", cmd_fail("switch", "testball", "0.1")