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.reopen(ENV['RELINE_STDERR_TTY'], 'w')
|
||||||
$stderr.sync = true
|
$stderr.sync = true
|
||||||
end
|
end
|
||||||
@@config.read
|
|
||||||
otio = Reline::IOGate.prep
|
otio = Reline::IOGate.prep
|
||||||
|
|
||||||
may_req_ambiguous_char_width
|
may_req_ambiguous_char_width
|
||||||
|
@ -324,9 +323,12 @@ module Reline
|
||||||
@@line_editor.pre_input_hook = @@pre_input_hook
|
@@line_editor.pre_input_hook = @@pre_input_hook
|
||||||
@@line_editor.rerender
|
@@line_editor.rerender
|
||||||
|
|
||||||
@@config.reset_default_key_bindings
|
unless @@config.test_mode
|
||||||
Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func|
|
@@config.read
|
||||||
@@config.add_default_key_binding(key, func)
|
@@config.reset_default_key_bindings
|
||||||
|
Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func|
|
||||||
|
@@config.add_default_key_binding(key, func)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
key_stroke = Reline::KeyStroke.new(@@config)
|
key_stroke = Reline::KeyStroke.new(@@config)
|
||||||
|
|
|
@ -78,7 +78,6 @@ class Reline::Config
|
||||||
end
|
end
|
||||||
|
|
||||||
def read(file = DEFAULT_PATH)
|
def read(file = DEFAULT_PATH)
|
||||||
return if @test_mode
|
|
||||||
file = ENV['INPUTRC'] if ENV['INPUTRC']
|
file = ENV['INPUTRC'] if ENV['INPUTRC']
|
||||||
begin
|
begin
|
||||||
if file.respond_to?(:readlines)
|
if file.respond_to?(:readlines)
|
||||||
|
|
|
@ -21,4 +21,10 @@ class Reline::WithinPipeTest < Reline::TestCase
|
||||||
@writer.write("abc\n")
|
@writer.write("abc\n")
|
||||||
assert_equal 'abc', Reline.readmultiline(&proc{ true })
|
assert_equal 'abc', Reline.readmultiline(&proc{ true })
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue