[ruby/reline] Fix default and additional key bindings vanish bug

(https://github.com/ruby/reline/pull/697)

fc9b4d2274
This commit is contained in:
tomoya ishida 2024-05-02 23:41:04 +09:00 committed by git
parent 2eefbef2ee
commit c78cebb469
5 changed files with 13 additions and 17 deletions

View file

@ -417,6 +417,18 @@ class Reline::Config::Test < Reline::TestCase
assert_equal expected, @config.key_bindings
end
def test_key_bindings_with_reset
# @config.reset is called after each readline.
# inputrc file is read once, so key binding shouldn't be cleared by @config.reset
@config.add_default_key_binding('default'.bytes, 'DEFAULT'.bytes)
@config.read_lines(<<~'LINES'.lines)
"additional": "ADDITIONAL"
LINES
@config.reset
expected = { 'default'.bytes => 'DEFAULT'.bytes, 'additional'.bytes => 'ADDITIONAL'.bytes }
assert_equal expected, @config.key_bindings
end
def test_history_size
@config.read_lines(<<~LINES.lines)
set history-size 5000

View file

@ -23,7 +23,6 @@ class Reline::WithinPipeTest < Reline::TestCase
@reader.close
@output_writer.close
@config.reset
@config.reset_default_key_bindings
Reline.test_reset
end