1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rake/test_namespace.rb
nobu bbaf596678 * test/rake/test_namespace.rb: not executable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-11 04:53:47 +00:00

44 lines
949 B
Ruby

require 'test/unit'
require 'rake'
class Rake::TestNameSpace < Test::Unit::TestCase
class TM
include Rake::TaskManager
end
def test_namespace_creation
mgr = TM.new
ns = Rake::NameSpace.new(mgr, [])
assert_not_nil ns
end
def test_namespace_lookup
mgr = TM.new
ns = mgr.in_namespace("n") do
mgr.define_task(Rake::Task, "t")
end
assert_not_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
end