Skip to content

Commit

Permalink
Add a test for oneshot key bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Sep 5, 2021
1 parent 26ebecd commit 42ebea8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/reline/test_key_stroke.rb
Expand Up @@ -46,4 +46,16 @@ def test_expand
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

0 comments on commit 42ebea8

Please sign in to comment.