1
0
Fork 0
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:
aycabta 2021-09-06 07:01:46 +09:00 committed by git
parent 14cc611133
commit 83a0807b3b

View file

@ -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