Skip to content

Commit

Permalink
test: Add test for Keg#mach_o_files hardlink behavior.
Browse files Browse the repository at this point in the history
Move dylib_path and bundle_path from test_mach to testing_env to
accommodate the new test.

Closes Homebrew#400.

Signed-off-by: Tim D. Smith <git@tim-smith.us>
  • Loading branch information
woodruffw authored and tdsmith committed Jun 28, 2016
1 parent 3e5e14a commit 62d7079
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
15 changes: 15 additions & 0 deletions Library/Homebrew/test/test_keg.rb
Expand Up @@ -304,4 +304,19 @@ def test_removes_broken_symlinks_that_conflict_with_directories
keg.unlink
keg.uninstall
end

def test_mach_o_files_skips_hardlinks
a = HOMEBREW_CELLAR.join("a", "1.0")
a.join("lib").mkpath
FileUtils.cp dylib_path("i386"), a.join("lib", "i386.dylib")
FileUtils.ln a.join("lib", "i386.dylib"), a.join("lib", "i386_link.dylib")

keg = Keg.new(a)
keg.link

assert_equal 1, keg.mach_o_files.size
ensure
keg.unlink
keg.uninstall
end
end
8 changes: 0 additions & 8 deletions 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?
Expand Down
8 changes: 8 additions & 0 deletions Library/Homebrew/test/testing_env.rb
Expand Up @@ -112,5 +112,13 @@ def refute_eql(exp, act, msg = nil)
}
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

0 comments on commit 62d7079

Please sign in to comment.