aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2014-07-12 19:56:58 -0500
committerJack Nagel2014-07-12 19:56:58 -0500
commit1eafe3bc354626b3d54164c263a5c57313d8eeeb (patch)
treef5cb5afd00faeccbae0f782dc14eaa6a2f6da3f7 /Library/Homebrew/test
parent7b26c885bd4cdb6ae50331082b368118c6c81ed1 (diff)
downloadbrew-1eafe3bc354626b3d54164c263a5c57313d8eeeb.tar.bz2
Handle conflicts where links point at symlinks
Fixes Homebrew/homebrew#30664.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_keg.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_keg.rb b/Library/Homebrew/test/test_keg.rb
index e415be433..fa7d591dc 100644
--- a/Library/Homebrew/test/test_keg.rb
+++ b/Library/Homebrew/test/test_keg.rb
@@ -217,4 +217,20 @@ class LinkTests < Homebrew::TestCase
assert_predicate link.resolved_path, :symlink?
assert_predicate link.lstat, :symlink?
end
+
+ def test_links_to_symlinks_are_not_removed
+ a = HOMEBREW_CELLAR.join("a", "1.0")
+ b = HOMEBREW_CELLAR.join("b", "1.0")
+
+ a.join("lib", "example").mkpath
+ a.join("lib", "example2").make_symlink "example"
+ b.join("lib", "example2").mkpath
+
+ Keg.new(a).link
+
+ lib = HOMEBREW_PREFIX.join("lib")
+ assert_equal 2, lib.children.length
+ assert_raises(Keg::ConflictError) { Keg.new(b).link }
+ assert_equal 2, lib.children.length
+ end
end