Skip to content

Commit

Permalink
Remove unused variables (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
ima1zumi authored Aug 27, 2024
1 parent c892885 commit 14784ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
16 changes: 0 additions & 16 deletions lib/reline/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,6 @@ def bind_variable(name, value, raw_value)
rescue ArgumentError
@history_size = 500
end
when 'bell-style'
@bell_style =
case value
when 'none', 'off'
:none
when 'audible', 'on'
:audible
when 'visible'
:visible
else
:audible
end
when 'comment-begin'
@comment_begin = value.dup
when 'completion-query-items'
@completion_query_items = value.to_i
when 'isearch-terminators'
@isearch_terminators = retrieve_string(raw_value)
when 'editing-mode'
Expand Down
32 changes: 16 additions & 16 deletions test/reline/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def registered_key_bindings(keys)

def test_read_lines
@config.read_lines(<<~LINES.lines)
set bell-style on
set show-mode-in-prompt on
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt)
end

def test_read_lines_with_variable
Expand Down Expand Up @@ -160,69 +160,69 @@ def test_bind_key_with_hexadecimal_number
def test_include
File.open('included_partial', 'wt') do |f|
f.write(<<~PARTIAL_LINES)
set bell-style on
set show-mode-in-prompt on
PARTIAL_LINES
end
@config.read_lines(<<~LINES.lines)
$include included_partial
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt)
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
set show-mode-in-prompt 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)
assert_equal true, @config.instance_variable_get(:@show_mode_in_prompt)
ensure
ENV['HOME'] = home_backup
end

def test_if
@config.read_lines(<<~LINES.lines)
$if Ruby
set bell-style audible
set vi-cmd-mode-string (cmd)
$else
set bell-style visible
set vi-cmd-mode-string [cmd]
$endif
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
assert_equal '(cmd)', @config.instance_variable_get(:@vi_cmd_mode_string)
end

def test_if_with_false
@config.read_lines(<<~LINES.lines)
$if Python
set bell-style audible
set vi-cmd-mode-string (cmd)
$else
set bell-style visible
set vi-cmd-mode-string [cmd]
$endif
LINES

assert_equal :visible, @config.instance_variable_get(:@bell_style)
assert_equal '[cmd]', @config.instance_variable_get(:@vi_cmd_mode_string)
end

def test_if_with_indent
%w[Ruby Reline].each do |cond|
@config.read_lines(<<~LINES.lines)
set bell-style none
set vi-cmd-mode-string {cmd}
$if #{cond}
set bell-style audible
set vi-cmd-mode-string (cmd)
$else
set bell-style visible
set vi-cmd-mode-string [cmd]
$endif
LINES

assert_equal :audible, @config.instance_variable_get(:@bell_style)
assert_equal '(cmd)', @config.instance_variable_get(:@vi_cmd_mode_string)
end
end

Expand Down

0 comments on commit 14784ed

Please sign in to comment.