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 1 commit
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
16 changes: 16 additions & 0 deletions test/reline/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ def test_include
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end

def test_include_expand_path
pwd = Dir.pwd
File.open('included_partial', 'wt') do |f|
f.write(<<~PARTIAL_LINES)
set bell-style on
PARTIAL_LINES
end
# '~/../ (...) /../PATH_TO/included_partial' => '/PATH_TO/included_partial'
path_to_be_expanded = File.join('~', ['..'] * 100, pwd, 'included_partial')
@config.read_lines(<<~LINES.lines)
$include #{path_to_be_expanded}
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
elfham marked this conversation as resolved.
Show resolved Hide resolved

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