mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add Reline test for unknown macro
This commit is contained in:
parent
e360688c4d
commit
486a2c26d6
3 changed files with 12 additions and 5 deletions
|
@ -304,7 +304,6 @@ module Reline
|
|||
$stderr.reopen(ENV['RELINE_STDERR_TTY'], 'w')
|
||||
$stderr.sync = true
|
||||
end
|
||||
@@config.read
|
||||
otio = Reline::IOGate.prep
|
||||
|
||||
may_req_ambiguous_char_width
|
||||
|
@ -324,9 +323,12 @@ module Reline
|
|||
@@line_editor.pre_input_hook = @@pre_input_hook
|
||||
@@line_editor.rerender
|
||||
|
||||
@@config.reset_default_key_bindings
|
||||
Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func|
|
||||
@@config.add_default_key_binding(key, func)
|
||||
unless @@config.test_mode
|
||||
@@config.read
|
||||
@@config.reset_default_key_bindings
|
||||
Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func|
|
||||
@@config.add_default_key_binding(key, func)
|
||||
end
|
||||
end
|
||||
|
||||
key_stroke = Reline::KeyStroke.new(@@config)
|
||||
|
|
|
@ -78,7 +78,6 @@ class Reline::Config
|
|||
end
|
||||
|
||||
def read(file = DEFAULT_PATH)
|
||||
return if @test_mode
|
||||
file = ENV['INPUTRC'] if ENV['INPUTRC']
|
||||
begin
|
||||
if file.respond_to?(:readlines)
|
||||
|
|
|
@ -21,4 +21,10 @@ class Reline::WithinPipeTest < Reline::TestCase
|
|||
@writer.write("abc\n")
|
||||
assert_equal 'abc', Reline.readmultiline(&proc{ true })
|
||||
end
|
||||
|
||||
def test_unknown_macro
|
||||
@config.add_default_key_binding('abc'.bytes, :unknown_macro)
|
||||
@writer.write("abcd\n")
|
||||
assert_equal 'd', Reline.readmultiline(&proc{ true })
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue