mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a0f667c33e
commit
719b0f8e30
71 changed files with 6679 additions and 72 deletions
84
test/rake/test_rdoc_task.rb
Normal file
84
test/rake/test_rdoc_task.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue