Skip to content

Commit

Permalink
[ruby/reline] Check empty .inputrc
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Jul 29, 2021
1 parent 51ee24e commit 46c6da9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reline/config.rb
Expand Up @@ -158,7 +158,7 @@ def reset_default_key_bindings
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)
Expand Down
6 changes: 6 additions & 0 deletions test/reline/test_config.rb
Expand Up @@ -311,6 +311,12 @@ def test_inputrc_with_eucjp
# 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']
Expand Down

0 comments on commit 46c6da9

Please sign in to comment.