[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
@ -46,4 +46,16 @@ class Reline::KeyStroke::Test < Reline::TestCase
|
|||||||
stroke = Reline::KeyStroke.new(config)
|
stroke = Reline::KeyStroke.new(config)
|
||||||
assert_equal('123'.bytes, stroke.expand('abc'.bytes))
|
assert_equal('123'.bytes, stroke.expand('abc'.bytes))
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user