1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc/*: Added --root option for building documentation outside

the source directory.
* test/rdoc/*:  ditto
* common.mk (rdoc):  Added --root to rdoc rule


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-11-27 08:54:03 +00:00
parent 7de9e2dfde
commit 6d1266a879
20 changed files with 169 additions and 35 deletions

View file

@ -141,6 +141,50 @@ class TestRDocRDoc < RDoc::TestCase
assert_match %r%/dev/stdin$%, err
end
def test_parse_file
pwd = Dir.pwd
@rdoc.store = RDoc::Store.new
temp_dir do |dir|
@rdoc.options.root = Pathname(Dir.pwd)
open 'test.txt', 'w' do |io|
io.puts 'hi'
end
test_txt = File.join dir, 'test.txt'
top_level = @rdoc.parse_file 'test.txt'
assert_equal 'test.txt', top_level.absolute_name
assert_equal 'test.txt', top_level.relative_name
end
end
def test_parse_file_relative
pwd = Dir.pwd
@rdoc.store = RDoc::Store.new
temp_dir do |dir|
@rdoc.options.root = Pathname(dir)
open 'test.txt', 'w' do |io|
io.puts 'hi'
end
test_txt = File.join dir, 'test.txt'
Dir.chdir pwd do
top_level = @rdoc.parse_file test_txt
assert_equal test_txt, top_level.absolute_name
assert_equal 'test.txt', top_level.relative_name
end
end
end
def test_parse_file_encoding
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@rdoc.options.encoding = Encoding::ISO_8859_1