diff options
| author | aycabta <aycabta@gmail.com> | 2021-09-06 07:01:46 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2021-09-06 08:10:02 +0900 |
| commit | 83a0807b3be32fea7ddb5f66bd40193e5981f6b9 (patch) | |
| tree | 6920360a3740c84c5a0fc5b903ea39fabb5eeca1 | |
| parent | 14cc611133fbd01a663321fcaceae5ce5141d902 (diff) | |
[ruby/reline] Add a test for oneshot key bindings
https://github.com/ruby/reline/commit/42ebea82b7
| -rw-r--r-- | test/reline/test_key_stroke.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/reline/test_key_stroke.rb b/test/reline/test_key_stroke.rb index 642ff5478d..7971598162 100644 --- a/test/reline/test_key_stroke.rb +++ b/test/reline/test_key_stroke.rb @@ -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 |
