Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config.rb to File.expand_path $include path in inputrc #592

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/reline/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def handle_directive(directive, file, no)
end
@skip_section = @if_stack.pop
when 'include'
read(args)
read(File.expand_path(args))
end
end

Expand Down
17 changes: 17 additions & 0 deletions test/reline/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ def test_include
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end

def test_include_expand_path
home_backup = ENV['HOME']
File.open('included_partial', 'wt') do |f|
f.write(<<~PARTIAL_LINES)
set bell-style on
PARTIAL_LINES
end
ENV['HOME'] = Dir.pwd
@config.read_lines(<<~LINES.lines)
$include ~/included_partial
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
ensure
ENV['HOME'] = home_backup
end
elfham marked this conversation as resolved.
Show resolved Hide resolved

def test_if
@config.read_lines(<<~LINES.lines)
$if Ruby
Expand Down