diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 19:07:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-02 19:07:55 +0000 |
commit | 719b0f8e3037e1033726b6487d7b0d9fc1412e7d (patch) | |
tree | c5a08c8c9abae9b7f0514f680f56553a7a03656a /test/rake/test_namespace.rb | |
parent | a0f667c33e24928374d494c9c33d0082355785e1 (diff) | |
download | ruby-719b0f8e3037e1033726b6487d7b0d9fc1412e7d.tar.gz |
* lib/rake: updated to rake code to rake-0.8.7 source code base.
* lib/rake/loaders/makefile.rb (Rake::MakefileLoader#process_line):
respace dependencies too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/test_namespace.rb')
-rwxr-xr-x | test/rake/test_namespace.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/rake/test_namespace.rb b/test/rake/test_namespace.rb new file mode 100755 index 0000000000..30608de122 --- /dev/null +++ b/test/rake/test_namespace.rb @@ -0,0 +1,44 @@ +require 'test/unit' +require 'rake' + +class 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 |