aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Woodruff2017-09-26 21:36:16 -0400
committerGitHub2017-09-26 21:36:16 -0400
commita1140f7b926ce7b87727a6cd105cbe2d788f3a4c (patch)
tree46f5cd3310d723cf2efb7f02a4a1f5f5d3b6bf2b
parent3a5de992597310ff9740c35c7618e01fe5e8afc7 (diff)
parent9f57840486b764eb1f637deb972ea33939b40d01 (diff)
downloadbrew-a1140f7b926ce7b87727a6cd105cbe2d788f3a4c.tar.bz2
Merge pull request #3079 from mansimarkaur/os_keg
Added tests for os/mac/keg
-rw-r--r--Library/Homebrew/test/os/mac/keg_spec.rb56
1 files changed, 41 insertions, 15 deletions
diff --git a/Library/Homebrew/test/os/mac/keg_spec.rb b/Library/Homebrew/test/os/mac/keg_spec.rb
index 562c2ba6a..4321c61cd 100644
--- a/Library/Homebrew/test/os/mac/keg_spec.rb
+++ b/Library/Homebrew/test/os/mac/keg_spec.rb
@@ -5,28 +5,54 @@ describe Keg do
subject { described_class.new(keg_path) }
- describe "#mach_o_files" do
- let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
+ let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
+ let(:file) { keg_path/"lib/i386.dylib" }
- before(:each) { (keg_path/"lib").mkpath }
+ before(:each) do
+ (keg_path/"lib").mkpath
+ cp dylib_path("i386"), file
+ subject.link
+ end
- after(:each) { subject.unlink }
+ after(:each) { subject.unlink }
- 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"
+ describe "#change_dylib_id" do
+ it "does nothing if given id is same as file's dylib id" do
+ id = file.dylib_id
+ file.change_dylib_id(id)
+ expect(file.dylib_id).to eq(id)
+ end
+ end
- subject.link
- expect(subject.mach_o_files.count).to eq(1)
+ describe "#change_install_name" do
+ it "does nothing if given name is same as file's install name" do
+ file.ensure_writable do
+ subject.each_install_name_for(file) do |name|
+ file.change_install_name(name, name)
+ expect(name).to eq(name)
+ end
+ end
end
- 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"
+ it "does nothing when install name start with '/'" do
+ file.ensure_writable do
+ subject.each_install_name_for(file) do |name|
+ new_name = subject.fixed_name(file, name)
+ file.change_install_name(name, new_name)
+ expect(name).not_to eq(new_name)
+ end
+ end
+ end
+ end
+
+ describe "#require_relocation?" do
+ it "is set to false at initialization" do
+ expect(subject.require_relocation?).to be false
+ end
- subject.link
- expect(subject.mach_o_files.count).to eq(1)
+ it "is set to true after linkage is fixed" do
+ subject.fix_dynamic_linkage
+ expect(subject.require_relocation?).to be true
end
end
end