1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Check empty .inputrc

b60b3b76cd
This commit is contained in:
aycabta 2021-07-24 15:01:22 +09:00
parent 51ee24e7f7
commit 46c6da9c37
2 changed files with 7 additions and 1 deletions

View file

@ -158,7 +158,7 @@ class Reline::Config
end
def read_lines(lines, file = nil)
if lines.first.encoding != Reline.encoding_system_needs
if not lines.empty? and lines.first.encoding != Reline.encoding_system_needs
begin
lines = lines.map do |l|
l.encode(Reline.encoding_system_needs)

View file

@ -311,6 +311,12 @@ class Reline::Config::Test < Reline::TestCase
# do nothing
end
def test_empty_inputrc
assert_nothing_raised do
@config.read_lines([])
end
end
def test_xdg_config_home
home_backup = ENV['HOME']
xdg_config_home_backup = ENV['XDG_CONFIG_HOME']