mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix variable catch
This commit is contained in:
parent
fb11e6089d
commit
ad8fbf444a
2 changed files with 9 additions and 1 deletions
|
@ -184,7 +184,7 @@ class Reline::Config
|
||||||
|
|
||||||
def bind_variable(name, value)
|
def bind_variable(name, value)
|
||||||
case name
|
case name
|
||||||
when VARIABLE_NAMES then
|
when *VARIABLE_NAMES then
|
||||||
variable_name = :"@#{name.tr(?-, ?_)}"
|
variable_name = :"@#{name.tr(?-, ?_)}"
|
||||||
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')
|
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')
|
||||||
when 'bell-style'
|
when 'bell-style'
|
||||||
|
|
|
@ -28,6 +28,14 @@ class Reline::Config::Test < Reline::TestCase
|
||||||
assert_equal :audible, @config.instance_variable_get(:@bell_style)
|
assert_equal :audible, @config.instance_variable_get(:@bell_style)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_read_lines_with_variable
|
||||||
|
@config.read_lines(<<~LINES.lines)
|
||||||
|
set disable-completion on
|
||||||
|
LINES
|
||||||
|
|
||||||
|
assert_equal true, @config.instance_variable_get(:@disable_completion)
|
||||||
|
end
|
||||||
|
|
||||||
def test_comment_line
|
def test_comment_line
|
||||||
@config.read_lines([" #a: error\n"])
|
@config.read_lines([" #a: error\n"])
|
||||||
assert_not_include @config.key_bindings, nil
|
assert_not_include @config.key_bindings, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue