test: Add tests for Keg#mach_o_files link behavior.
Move dylib_path and bundle_path from test_mach to testing_env to accommodate the new tests. Closes #400. Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
parent
d3ef56425a
commit
cb3ad215b4
@ -304,4 +304,35 @@ class LinkTests < Homebrew::TestCase
|
|||||||
keg.unlink
|
keg.unlink
|
||||||
keg.uninstall
|
keg.uninstall
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@ -1,14 +1,6 @@
|
|||||||
require "testing_env"
|
require "testing_env"
|
||||||
|
|
||||||
class MachOPathnameTests < Homebrew::TestCase
|
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
|
def test_fat_dylib
|
||||||
pn = dylib_path("fat")
|
pn = dylib_path("fat")
|
||||||
assert_predicate pn, :universal?
|
assert_predicate pn, :universal?
|
||||||
|
|||||||
@ -112,5 +112,13 @@ module Homebrew
|
|||||||
}
|
}
|
||||||
refute exp.eql?(act), msg
|
refute exp.eql?(act), msg
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user