mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Add a test for oneshot key bindings
https://github.com/ruby/reline/commit/42ebea82b7
This commit is contained in:
parent
14cc611133
commit
83a0807b3b
1 changed files with 12 additions and 0 deletions
|
@ -46,4 +46,16 @@ class Reline::KeyStroke::Test < Reline::TestCase
|
|||
stroke = Reline::KeyStroke.new(config)
|
||||
assert_equal('123'.bytes, stroke.expand('abc'.bytes))
|
||||
end
|
||||
|
||||
def test_oneshot_key_bindings
|
||||
config = Reline::Config.new
|
||||
{
|
||||
'abc' => '123',
|
||||
}.each_pair do |key, func|
|
||||
config.add_default_key_binding(key.bytes, func.bytes)
|
||||
end
|
||||
stroke = Reline::KeyStroke.new(config)
|
||||
assert_equal(:unmatched, stroke.match_status('zzz'.bytes))
|
||||
assert_equal(:matched, stroke.match_status('abc'.bytes))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue