<commit_before>require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require 'thread'

describe "Module#autoload?" do
  it "returns the name of the file that will be autoloaded" do
    ModuleSpecs::Autoload.autoload :Autoload, "autoload.rb"
    ModuleSpecs::Autoload.autoload?(:Autoload).should == "autoload.rb"
  end

  it "returns nil if no file has been registered for a constant" do
    ModuleSpecs::Autoload.autoload?(:Manualload).should be_nil
  end

  it "returns the name of the file that will be autoloaded if an ancestor defined that autoload" do
    ModuleSpecs::Autoload::Parent.autoload :AnotherAutoload, "another_autoload.rb"
    ModuleSpecs::Autoload::Child.autoload?(:AnotherAutoload).should == "another_autoload.rb"
  end

  ruby_version_is "2.7" do
    it "returns nil if an ancestor defined that autoload but recursion is disabled" do
      ModuleSpecs::Autoload::Parent.autoload :AnotherAutoload, "another_autoload.rb"
      ModuleSpecs::Autoload::Child.autoload?(:AnotherAutoload, false).should be_nil
    end

    it "returns the name of the file that will be loaded if recursion is disabled but the autoload is defined on the classs itself" do
      ModuleSpecs::Autoload::Child.autoload :AnotherAutoload, "another_autoload.rb"
      ModuleSpecs::Autoload::Child.autoload?(:AnotherAutoload, false).should == "another_autoload.rb"
    end<commit_msg>Use different names for autoload constants in specs for clarity<commit_after>require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require 'thread'

describe "Module#autoload?" do
  it "returns the name of the file that will be autoloaded" do
    ModuleSpecs::Autoload.autoload :Autoload, "autoload.rb"
    ModuleSpecs::Autoload.autoload?(:Autoload).should == "autoload.rb"
  end

  it "returns nil if no file has been registered for a constant" do
    ModuleSpecs::Autoload.autoload?(:Manualload).should be_nil
  end

  it "returns the name of the file that will be autoloaded if an ancestor defined that autoload" do
    ModuleSpecs::Autoload::Parent.autoload :AnotherAutoload, "another_autoload.rb"
    ModuleSpecs::Autoload::Child.autoload?(:AnotherAutoload).should == "another_autoload.rb"
  end

  ruby_version_is "2.7" do
    it "returns nil if an ancestor defined that autoload but recursion is disabled" do
      ModuleSpecs::Autoload::Parent.autoload :InheritedAutoload, "inherited_autoload.rb"
      ModuleSpecs::Autoload::Child.autoload?(:InheritedAutoload, false).should be_nil
    end

    it "returns the name of the file that will be loaded if recursion is disabled but the autoload is defined on the classs itself" do
      ModuleSpecs::Autoload::Child.autoload :ChildAutoload, "child_autoload.rb"
      ModuleSpecs::Autoload::Child.autoload?(:ChildAutoload, false).should == "child_autoload.rb"
    end
{'fraction_non_alphanumeric': 0.09469964664310954, 'fraction_numerical': 0.0014134275618374558, 'mean_word_length': 4.947478991596639, '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': '4412340', 'n_tokens_mistral': 949, 'n_tokens_neox': 914, 'n_words': 254}