diff options
author | Sven Riedel <sriedel@users.noreply.github.com> | 2022-11-28 05:36:26 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-11-28 04:36:29 +0000 |
commit | e0901f46b7c62acb2cbc9b05ee5753baeb37b82d (patch) | |
tree | fd64532fc736c13d81d487e7f941a323c7b40769 /test | |
parent | 745dcf5326ea2c8e2047a3bddeb0fbb7e7d07649 (diff) |
[ruby/rdoc] Add `--no-skipping-tests` option
https://github.com/ruby/rdoc/commit/33925f885f
Diffstat (limited to 'test')
-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 |