[ruby/rdoc] Ignore `locale` at `write_options`

`@locale` is set from `@locale_name` and loaded from `@locale_dir`
after `write_options`, and `RDoc::I18n::Locale` does not seem to
expected to be loaded.

https://github.com/ruby/rdoc/commit/fd610f7023
This commit is contained in:
Nobuyoshi Nakada 2024-01-06 19:08:10 +09:00 коммит произвёл git
Родитель 913b26d0fd
Коммит f6847e9456
2 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -105,6 +105,7 @@ class RDoc::Options
generator_name
generator_options
generators
locale
op_dir
page_dir
option_parser

Просмотреть файл

@ -68,7 +68,6 @@ class TestRDocOptions < RDoc::TestCase
'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z \.gemspec\z],
'hyperlink_all' => false,
'line_numbers' => false,
'locale' => nil,
'locale_dir' => 'locale',
'locale_name' => nil,
'main_page' => nil,
@ -902,6 +901,28 @@ rdoc_include:
assert_equal false, @options.skip_tests
end
def test_locale_name_default
temp_dir do
@options.parse %w[]
assert_equal 'locale', @options.instance_variable_get(:@locale_dir)
assert_nil @options.instance_variable_get(:@locale_name)
assert_nil @options.locale
@options.finish
assert_nil @options.locale
end
end
def test_locale_name
temp_dir do
@options.parse %w[--locale fr]
assert_equal 'locale', @options.instance_variable_get(:@locale_dir)
assert_equal 'fr', @options.instance_variable_get(:@locale_name)
assert_nil @options.locale
@options.finish
assert_equal 'fr', @options.locale.name
end
end
class DummyCoder < Hash
alias add :[]=
def tag=(tag)