Sha256: bc1c1b1f396be49f32c06daa6d75f99284a76945db4609599a44a73ddf579d31

Contents?: true

Size: 937 Bytes

Versions: 12

Compression:

Stored size: 937 Bytes

Contents

require 'test_helper'

class KernelRequireTest < ActiveSupport::TestCase

  setup do
    require 'derailed_benchmarks/core_ext/kernel_require'
    GC.disable
  end

  teardown do
    GC.enable
  end

  def assert_node_in_parent(file_name, parent)
    file = fixtures_dir(File.join("require", file_name))
    node = parent[file]
    assert node,                    "Expected:\n#{parent.children}\nto include:\n#{file.inspect}"
    assert node.cost < parent.cost, "Expected:\n#{node.inspect}\nto cost less than:\n#{parent.inspect}" unless parent == TOP_REQUIRE
    node
  end

  test "core extension profiles useage" do
    require fixtures_dir("require/parent_one.rb")
    parent    = assert_node_in_parent("parent_one.rb", TOP_REQUIRE)
    child_one = assert_node_in_parent("child_one.rb", parent)
    child_two = assert_node_in_parent("child_two.rb", parent)
    rse_child = assert_node_in_parent("raise_child.rb", child_two)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
derailed_benchmarks-1.3.5 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.3.4 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.3.3 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.3.2 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.3.1 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.3.0 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.1.3 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.1.2 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.1.1 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.1.0 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.0.1 test/derailed_benchmarks/core_ext/kernel_require_test.rb
derailed_benchmarks-1.0.0 test/derailed_benchmarks/core_ext/kernel_require_test.rb