aboutsummaryrefslogtreecommitdiffstats
path: root/test/rdoc/test_rdoc_rdoc.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index b0a0fadc49..5ed7ce77b0 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -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