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_rdoc_task.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_rdoc_task.rb')
-rw-r--r-- | test/rake/test_rdoc_task.rb | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/rake/test_rdoc_task.rb b/test/rake/test_rdoc_task.rb new file mode 100644 index 0000000000..524057cf07 --- /dev/null +++ b/test/rake/test_rdoc_task.rb @@ -0,0 +1,84 @@ +require 'test/unit' +require 'rake/rdoctask' + +class TestRDocTask < Test::Unit::TestCase + include Rake + + def setup + Task.clear + end + + def test_tasks_creation + Rake::RDocTask.new + assert Task[:rdoc] + assert Task[:clobber_rdoc] + assert Task[:rerdoc] + end + + def test_tasks_creation_with_custom_name_symbol + rd = Rake::RDocTask.new(:rdoc_dev) + assert Task[:rdoc_dev] + assert Task[:clobber_rdoc_dev] + assert Task[:rerdoc_dev] + assert_equal :rdoc_dev, rd.name + end + + def test_tasks_creation_with_custom_name_string + rd = Rake::RDocTask.new("rdoc_dev") + assert Task[:rdoc_dev] + assert Task[:clobber_rdoc_dev] + assert Task[:rerdoc_dev] + assert_equal "rdoc_dev", rd.name + end + + def test_tasks_creation_with_custom_name_hash + options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" } + rd = Rake::RDocTask.new(options) + assert Task[:"rdoc"] + assert Task[:"rdoc:clean"] + assert Task[:"rdoc:force"] + assert_raises(RuntimeError) { Task[:clobber_rdoc] } + assert_equal options, rd.name + end + + def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given + rd = Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean") + assert Task[:rdoc] + assert Task[:"rdoc:clean"] + assert Task[:rerdoc] + end + + def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given + assert_raises(ArgumentError) do + Rake::RDocTask.new(:foo => "bar") + end + + begin + Rake::RDocTask.new(:foo => "bar") + rescue ArgumentError => e + assert_match(/foo/, e.message) + end + end + + def test_inline_source_is_enabled_by_default + rd = Rake::RDocTask.new + assert rd.option_list.include?('--inline-source') + end + + def test_inline_source_option_is_only_appended_if_option_not_already_given + rd = Rake::RDocTask.new + rd.options << '--inline-source' + assert_equal 1, rd.option_list.grep('--inline-source').size + + rd = Rake::RDocTask.new + rd.options << '-S' + assert_equal 1, rd.option_list.grep('-S').size + assert_equal 0, rd.option_list.grep('--inline-source').size + end + + def test_inline_source_option_can_be_disabled + rd = Rake::RDocTask.new + rd.inline_source = false + assert !rd.option_list.include?('--inline-source') + end +end |