aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_keg.rb31
-rw-r--r--Library/Homebrew/test/test_mach.rb8
-rw-r--r--Library/Homebrew/test/testing_env.rb8
3 files changed, 39 insertions, 8 deletions
diff --git a/Library/Homebrew/test/test_keg.rb b/Library/Homebrew/test/test_keg.rb
index 9e4254667..f02a65a32 100644
--- a/Library/Homebrew/test/test_keg.rb
+++ b/Library/Homebrew/test/test_keg.rb
@@ -304,4 +304,35 @@ class LinkTests < Homebrew::TestCase
keg.unlink
keg.uninstall
end
+
+ def test_mach_o_files_skips_hardlinks
+ a = HOMEBREW_CELLAR/"a/1.0"
+ (a/"lib").mkpath
+ FileUtils.cp dylib_path("i386"), a/"lib/i386.dylib"
+ FileUtils.ln a/"lib/i386.dylib", a/"lib/i386_link.dylib"
+
+ keg = Keg.new(a)
+ keg.link
+
+ assert_equal 1, keg.mach_o_files.size
+ ensure
+ keg.unlink
+ keg.uninstall
+ end
+
+ def test_mach_o_files_isnt_confused_by_symlinks
+ a = HOMEBREW_CELLAR/"a/1.0"
+ (a/"lib").mkpath
+ FileUtils.cp dylib_path("i386"), a/"lib/i386.dylib"
+ FileUtils.ln a/"lib/i386.dylib", a/"lib/i386_link.dylib"
+ FileUtils.ln_s a/"lib/i386.dylib", a/"lib/1.dylib"
+
+ keg = Keg.new(a)
+ keg.link
+
+ assert_equal 1, keg.mach_o_files.size
+ ensure
+ keg.unlink
+ keg.uninstall
+ end
end
diff --git a/Library/Homebrew/test/test_mach.rb b/Library/Homebrew/test/test_mach.rb
index a1f62dcf3..404a21d60 100644
--- a/Library/Homebrew/test/test_mach.rb
+++ b/Library/Homebrew/test/test_mach.rb
@@ -1,14 +1,6 @@
require "testing_env"
class MachOPathnameTests < Homebrew::TestCase
- def dylib_path(name)
- Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib")
- end
-
- def bundle_path(name)
- Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle")
- end
-
def test_fat_dylib
pn = dylib_path("fat")
assert_predicate pn, :universal?
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 4e7089e42..6be622cc5 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -112,5 +112,13 @@ module Homebrew
}
refute exp.eql?(act), msg
end
+
+ def dylib_path(name)
+ Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.dylib")
+ end
+
+ def bundle_path(name)
+ Pathname.new("#{TEST_DIRECTORY}/mach/#{name}.bundle")
+ end
end
end