brew/Library/Homebrew/test/os/mac/keg_spec.rb

36 lines
835 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: false
# frozen_string_literal: true
2017-02-21 04:52:53 +01:00
require "keg"
describe Keg do
include FileUtils
subject(:keg) { described_class.new(keg_path) }
2017-02-21 04:52:53 +01:00
2017-09-27 02:57:12 -07:00
describe "#mach_o_files" do
let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
2017-02-21 04:52:53 +01:00
before { (keg_path/"lib").mkpath }
2017-02-21 04:52:53 +01:00
after { keg.unlink }
2017-02-21 04:52:53 +01:00
2017-09-27 02:57:12 -07:00
it "skips hardlinks" do
cp dylib_path("i386"), keg_path/"lib/i386.dylib"
ln keg_path/"lib/i386.dylib", keg_path/"lib/i386_hardlink.dylib"
2017-02-21 04:52:53 +01:00
keg.link
expect(keg.mach_o_files.count).to eq(1)
2017-02-21 04:52:53 +01:00
end
2017-09-27 02:57:12 -07:00
it "isn't confused by symlinks" do
cp dylib_path("i386"), keg_path/"lib/i386.dylib"
ln keg_path/"lib/i386.dylib", keg_path/"lib/i386_hardlink.dylib"
ln_s keg_path/"lib/i386.dylib", keg_path/"lib/i386_symlink.dylib"
2017-02-21 04:52:53 +01:00
keg.link
expect(keg.mach_o_files.count).to eq(1)
2017-02-21 04:52:53 +01:00
end
end
end