mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[ruby/optparse] Use ~/.config
only if $XDG_CONFIG_HOME
is unset or empty
2f9c7500a3
This commit is contained in:
parent
3ad26d0501
commit
f76ce9fd28
2 changed files with 21 additions and 5 deletions
|
@ -47,7 +47,7 @@ class TestOptionParserLoad < Test::Unit::TestCase
|
|||
begin
|
||||
yield dir, optdir
|
||||
ensure
|
||||
File.unlink(file)
|
||||
File.unlink(file) rescue nil
|
||||
Dir.rmdir(optdir) rescue nil
|
||||
end
|
||||
else
|
||||
|
@ -101,7 +101,7 @@ class TestOptionParserLoad < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_load_xdg_config_home
|
||||
result, = setup_options_xdg_config_home
|
||||
result, dir = setup_options_xdg_config_home
|
||||
assert_load(result)
|
||||
|
||||
setup_options_home_config do
|
||||
|
@ -115,6 +115,11 @@ class TestOptionParserLoad < Test::Unit::TestCase
|
|||
setup_options_home_config_settings do
|
||||
assert_load(result)
|
||||
end
|
||||
|
||||
File.unlink("#{dir}/#{@basename}.options")
|
||||
setup_options_home_config do
|
||||
assert_load_nothing
|
||||
end
|
||||
end
|
||||
|
||||
def test_load_home_config
|
||||
|
@ -128,6 +133,11 @@ class TestOptionParserLoad < Test::Unit::TestCase
|
|||
setup_options_home_config_settings do
|
||||
assert_load(result)
|
||||
end
|
||||
|
||||
setup_options_xdg_config_home do |_, dir|
|
||||
File.unlink("#{dir}/#{@basename}.options")
|
||||
assert_load_nothing
|
||||
end
|
||||
end
|
||||
|
||||
def test_load_xdg_config_dirs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue