From f1e923631c9e1d3ec722cd805d408e0d697a84aa Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Fri, 25 Oct 2024 16:39:39 +0900 Subject: [PATCH] [ruby/reline] Add completion_append_character test (https://github.com/ruby/reline/pull/773) https://github.com/ruby/reline/commit/5f5a0aa78c --- test/reline/test_key_actor_emacs.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index 2a25c48941..a7e60a509b 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -939,6 +939,22 @@ class Reline::KeyActor::EmacsTest < Reline::TestCase assert_line_around_cursor('foo', '') end + def test_completion_append_character + @line_editor.completion_proc = proc { |word| + %w[foo_ foo_foo foo_bar].select { |s| s.start_with? word } + } + @line_editor.completion_append_character = 'X' + input_keys('f') + input_keys("\C-i", false) + assert_line_around_cursor('foo_', '') + input_keys('f') + input_keys("\C-i", false) + assert_line_around_cursor('foo_fooX', '') + input_keys(' foo_bar') + input_keys("\C-i", false) + assert_line_around_cursor('foo_fooX foo_barX', '') + end + def test_completion_with_completion_ignore_case @line_editor.completion_proc = proc { |word| %w{