<commit_before>require "keg"

describe Keg do
  include FileUtils

  subject { described_class.new(keg_path) }

  let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }
  let(:file) { keg_path/"lib/i386.dylib" }

  before(:each) do
    (keg_path/"lib").mkpath
    cp dylib_path("i386"), file
    subject.link
  end

  after(:each) { subject.unlink }

  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

  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 "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

    it "is set to true after linkage is fixed" do
      subject.fix_dynamic_linkage
      expect(subject.require_relocation?).to be true
    end
  end
end<commit_msg>Revert "Added tests for os/mac/keg"<commit_after>require "keg"

describe Keg do
  include FileUtils

  subject { described_class.new(keg_path) }

  describe "#mach_o_files" do
    let(:keg_path) { HOMEBREW_CELLAR/"a/1.0" }

    before(:each) { (keg_path/"lib").mkpath }

    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"

      subject.link
      expect(subject.mach_o_files.count).to eq(1)
    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"

      subject.link
      expect(subject.mach_o_files.count).to eq(1)
    end
  end
end
{'fraction_non_alphanumeric': 0.10676307954062102, 'fraction_numerical': 0.01786473840918758, 'mean_word_length': 2.881188118811881, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1872564', 'n_tokens_mistral': 912, 'n_tokens_neox': 856, 'n_words': 187}