Sha256: 52492e981e14cb8819ee1fd91238877c4906f61395755cbb77da49efc87fc790

Contents?: true

Size: 1.14 KB

Versions: 199

Compression:

Stored size: 1.14 KB

Contents

require File.expand_path('../helper', __FILE__)

class TestRakeNameSpace < Rake::TestCase

  class TM
    include Rake::TaskManager
  end

  def test_namespace_creation
    mgr = TM.new
    ns = Rake::NameSpace.new(mgr, [])
    refute_nil ns
  end

  def test_namespace_lookup
    mgr = TM.new
    ns = mgr.in_namespace("n") do
      mgr.define_task(Rake::Task, "t")
    end

    refute_nil ns["t"]
    assert_equal mgr["n:t"], ns["t"]
  end

  def test_namespace_reports_tasks_it_owns
    mgr = TM.new
    nns = nil
    ns = mgr.in_namespace("n") do
      mgr.define_task(Rake::Task, :x)
      mgr.define_task(Rake::Task, :y)
      nns = mgr.in_namespace("nn") do
        mgr.define_task(Rake::Task, :z)
      end
    end
    mgr.in_namespace("m") do
      mgr.define_task(Rake::Task, :x)
    end

    assert_equal ["n:nn:z", "n:x", "n:y"],
      ns.tasks.map { |tsk| tsk.name }
    assert_equal ["n:nn:z"], nns.tasks.map { |t| t.name }
  end

  def test_scope
    mgr = TM.new

    scope = Rake::LinkedList.new 'b'
    scope = scope.conj 'a'

    ns = Rake::NameSpace.new mgr, scope

    assert_equal scope, ns.scope

    refute_same scope, ns.scope
  end

end

Version data entries

199 entries across 176 versions & 64 rubygems

Version Path
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/lgrgic_palindrome_detector-0.1.0/vendor/cache/gems/rake-10.5.0/test/test_rake_name_space.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/rake-10.5.0/test/test_rake_name_space.rb
lgrgic_palindrome_detector-0.1.0 vendor/cache/gems/rake-10.5.0/test/test_rake_name_space.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.1.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
wfrey_palindrome-0.1.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
bsielski_control_flow-1.0.0 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
daslabs-0.12.0 vendor/cache/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
daslabs-0.11.0 vendor/cache/ruby/2.5.0/gems/rake-10.5.0/test/test_rake_name_space.rb
sprokovuln-0.2.0 vendor/ruby/gems/rake-10.5.0/test/test_rake_name_space.rb
mercadopago-custom-checkout-0.1.2 .gs/gems/rake-10.5.0/test/test_rake_name_space.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_rake_name_space.rb
sb_prime_table-0.1.1 vendor/bundle/ruby/2.4.0/gems/rake-10.5.0/test/test_rake_name_space.rb
sb_prime_table-0.1.0 vendor/bundle/ruby/2.4.0/gems/rake-10.5.0/test/test_rake_name_space.rb