diff options
Diffstat (limited to 'test/rdoc')
-rw-r--r-- | test/rdoc/test_rdoc_options.rb | 11 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 42 |
2 files changed, 53 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index 009dcdd998..c71ee25cef 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -83,6 +83,7 @@ class TestRDocOptions < RDoc::TestCase 'title' => nil, 'visibility' => :protected, 'webcvs' => nil, + 'skip_tests' => true, } assert_equal expected, coder @@ -871,6 +872,16 @@ rdoc_include: end end + def test_skip_test_default_value + @options.parse %w[] + assert_equal true, @options.skip_tests + end + + def test_no_skip_test_value + @options.parse %w[--no-skipping-tests] + assert_equal false, @options.skip_tests + end + class DummyCoder < Hash alias add :[]= def tag=(tag) diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index e958e5f2f6..853d7dad22 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -213,6 +213,48 @@ class TestRDocRDoc < RDoc::TestCase assert_equal expected_files, files end + def test_normalized_file_list_with_skipping_tests_enabled + files = temp_dir do |dir| + @a = File.expand_path('a.rb') + spec_dir = File.expand_path('spec') + spec_file = File.expand_path(File.join('spec', 'my_spec.rb')) + test_dir = File.expand_path('test') + test_file = File.expand_path(File.join('test', 'my_test.rb')) + FileUtils.touch @a + FileUtils.mkdir_p spec_dir + FileUtils.touch spec_file + FileUtils.mkdir_p test_dir + FileUtils.touch test_file + + @rdoc.options.skip_tests = true + @rdoc.normalized_file_list [File.realpath(dir)] + end + + files = files.map { |file, *| File.expand_path file } + assert_equal [@a], files + end + + def test_normalized_file_list_with_skipping_tests_disabled + files = temp_dir do |dir| + @a = File.expand_path('a.rb') + spec_dir = File.expand_path('spec') + @spec_file = File.expand_path(File.join('spec', 'my_spec.rb')) + test_dir = File.expand_path('test') + @test_file = File.expand_path(File.join('test', 'my_test.rb')) + FileUtils.touch @a + FileUtils.mkdir_p spec_dir + FileUtils.touch @spec_file + FileUtils.mkdir_p test_dir + FileUtils.touch @test_file + + @rdoc.options.skip_tests = false + @rdoc.normalized_file_list [File.realpath(dir)] + end + + files = files.map { |file, *| File.expand_path file } + assert_equal [@a, @spec_file, @test_file], files.sort + end + def test_parse_file @rdoc.store = RDoc::Store.new |