diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-27 10:45:24 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-27 10:45:24 +0000 |
commit | 55518710865bd7258422807524403c91347519a2 (patch) | |
tree | 4146c423ab0c55ed35d9d860e64d7e3a7e2a9efb /test/rdoc/test_rdoc_rdoc.rb | |
parent | 2d9f20e1cfdc7532a8acef4da9b8b7a788c4e99a (diff) |
Merge rdoc-6.0.0.beta4 from upstream.
It version applied `frozen_string_literal: true`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index 39f54555b5..3244238e3c 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRDoc < RDoc::TestCase @@ -40,6 +40,34 @@ class TestRDocRDoc < RDoc::TestCase assert_equal 'title', store.title end + def test_document_with_dry_run # functional test + options = RDoc::Options.new + options.files = [File.expand_path('../xref_data.rb', __FILE__)] + options.setup_generator 'darkfish' + options.main_page = 'MAIN_PAGE.rdoc' + options.root = Pathname File.expand_path('..', __FILE__) + options.title = 'title' + options.dry_run = true + + rdoc = RDoc::RDoc.new + + out = nil + temp_dir do + out, = capture_io do + rdoc.document options + end + + refute File.directory? 'doc' + assert_equal rdoc, rdoc.store.rdoc + end + assert_includes out, '100%' + + store = rdoc.store + + assert_equal 'MAIN_PAGE.rdoc', store.main + assert_equal 'title', store.title + end + def test_gather_files a = File.expand_path __FILE__ b = File.expand_path '../test_rdoc_text.rb', __FILE__ @@ -109,17 +137,18 @@ class TestRDocRDoc < RDoc::TestCase end def test_normalized_file_list + test_path = File.expand_path(__FILE__) files = temp_dir do |dir| flag_file = @rdoc.output_flag_file dir FileUtils.touch flag_file - @rdoc.normalized_file_list [__FILE__, flag_file] + @rdoc.normalized_file_list [test_path, flag_file] end files = files.map { |file| File.expand_path file } - assert_equal [File.expand_path(__FILE__)], files + assert_equal [test_path], files end def test_normalized_file_list_not_modified @@ -189,9 +218,10 @@ class TestRDocRDoc < RDoc::TestCase def test_parse_file_include_root @rdoc.store = RDoc::Store.new + test_path = File.expand_path('..', __FILE__) top_level = nil temp_dir do |dir| - @rdoc.options.parse %W[--root #{File.dirname(__FILE__)}] + @rdoc.options.parse %W[--root #{test_path}] open 'include.txt', 'w' do |io| io.puts ':include: test.txt' |