diff options
author | aycabta <aycabta@gmail.com> | 2020-10-14 23:29:17 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2020-12-05 02:58:58 +0900 |
commit | 4af2e4111b0e351464a62c73e4ea0ef8b27c43f5 (patch) | |
tree | 9be60f1bc46f855afbada50700188a5e9037e4f1 /test/reline | |
parent | e16e481385743666443e162141116b46416cb10d (diff) |
[ruby/reline] Deduplicate completed items
https://github.com/ruby/reline/commit/2dabf0c786
Diffstat (limited to 'test/reline')
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index a1e4015999..7bb5ac3141 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -1281,6 +1281,36 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_equal(%w{foo_foo foo_bar foo_baz}, @line_editor.instance_variable_get(:@menu_info).list) end + def test_completion_duplicated_list + @line_editor.completion_proc = proc { |word| + %w{ + foo_foo + foo_foo + foo_bar + }.map { |i| + i.encode(@encoding) + } + } + input_keys('foo_') + assert_byte_pointer_size('foo_') + assert_cursor(4) + assert_cursor_max(4) + assert_line('foo_') + assert_equal(nil, @line_editor.instance_variable_get(:@menu_info)) + input_keys("\C-i", false) + assert_byte_pointer_size('foo_') + assert_cursor(4) + assert_cursor_max(4) + assert_line('foo_') + assert_equal(nil, @line_editor.instance_variable_get(:@menu_info)) + input_keys("\C-i", false) + assert_byte_pointer_size('foo_') + assert_cursor(4) + assert_cursor_max(4) + assert_line('foo_') + assert_equal(%w{foo_foo foo_bar}, @line_editor.instance_variable_get(:@menu_info).list) + end + def test_completion @line_editor.completion_proc = proc { |word| %w{ |