test_keg: port to generic layer.
This commit is contained in:
parent
7f2f602e44
commit
51dd73dba8
@ -304,35 +304,4 @@ 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
|
||||
|
||||
69
Library/Homebrew/test/test_os_mac_keg.rb
Normal file
69
Library/Homebrew/test/test_os_mac_keg.rb
Normal file
@ -0,0 +1,69 @@
|
||||
require "testing_env"
|
||||
require "keg"
|
||||
require "stringio"
|
||||
|
||||
class OSMacLinkTests < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
keg = HOMEBREW_CELLAR.join("foo", "1.0")
|
||||
keg.join("bin").mkpath
|
||||
|
||||
%w[hiworld helloworld goodbye_cruel_world].each do |file|
|
||||
touch keg.join("bin", file)
|
||||
end
|
||||
|
||||
@keg = Keg.new(keg)
|
||||
@dst = HOMEBREW_PREFIX.join("bin", "helloworld")
|
||||
@nonexistent = Pathname.new("/some/nonexistent/path")
|
||||
|
||||
@mode = OpenStruct.new
|
||||
|
||||
@old_stdout = $stdout
|
||||
$stdout = StringIO.new
|
||||
|
||||
mkpath HOMEBREW_PREFIX/"bin"
|
||||
mkpath HOMEBREW_PREFIX/"lib"
|
||||
end
|
||||
|
||||
def teardown
|
||||
@keg.unlink
|
||||
@keg.uninstall
|
||||
|
||||
$stdout = @old_stdout
|
||||
|
||||
rmtree HOMEBREW_PREFIX/"bin"
|
||||
rmtree HOMEBREW_PREFIX/"lib"
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user