aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-24 18:32:50 +0900
committeraycabta <aycabta@gmail.com>2019-12-24 18:34:43 +0900
commit42e2a322f100c7c798fcfbcbbfe0b4cdaf3f5855 (patch)
treefbfb616dc4ba44ae2fb368c5566179af8884a817 /test
parentb03aea62abfbdc7c8ee53c30a27127c3c394a6ba (diff)
downloadruby-42e2a322f100c7c798fcfbcbbfe0b4cdaf3f5855.tar.gz
The delete-char-or-list shows completed list when called at end of line
It doesn't behave the same as the delete-char.
Diffstat (limited to 'test')
-rw-r--r--test/reline/test_key_actor_emacs.rb43
1 files changed, 40 insertions, 3 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb
index 8854df56a2..97ff654506 100644
--- a/test/reline/test_key_actor_emacs.rb
+++ b/test/reline/test_key_actor_emacs.rb
@@ -372,7 +372,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_line('abcd012ABCa')
end
- def test_em_delete_or_list
+ def test_em_delete
input_keys('ab')
assert_byte_pointer_size('ab')
assert_cursor(2)
@@ -388,7 +388,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_line('b')
end
- def test_em_delete_or_list_for_mbchar
+ def test_em_delete_for_mbchar
input_keys('かき')
assert_byte_pointer_size('かき')
assert_cursor(4)
@@ -407,7 +407,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_line('き')
end
- def test_em_delete_or_list_for_mbchar_by_plural_code_points
+ def test_em_delete_for_mbchar_by_plural_code_points
input_keys("か\u3099き\u3099")
assert_byte_pointer_size("か\u3099き\u3099")
assert_cursor(4)
@@ -1244,6 +1244,43 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
assert_line('{}#* AAA!!!CCC ')
end
+ def test_em_delete_or_list
+ @line_editor.completion_proc = proc { |word|
+ %w{
+ foo_foo
+ foo_bar
+ foo_baz
+ qux
+ }.map { |i|
+ i.encode(@encoding)
+ }
+ }
+ input_keys('fooo')
+ assert_byte_pointer_size('fooo')
+ assert_cursor(4)
+ assert_cursor_max(4)
+ assert_line('fooo')
+ assert_equal(nil, @line_editor.instance_variable_get(:@menu_info))
+ input_keys("\C-b", false)
+ assert_byte_pointer_size('foo')
+ assert_cursor(3)
+ assert_cursor_max(4)
+ assert_line('fooo')
+ assert_equal(nil, @line_editor.instance_variable_get(:@menu_info))
+ @line_editor.input_key(Reline::Key.new(:em_delete_or_list, :em_delete_or_list, false))
+ assert_byte_pointer_size('foo')
+ assert_cursor(3)
+ assert_cursor_max(3)
+ assert_line('foo')
+ assert_equal(nil, @line_editor.instance_variable_get(:@menu_info))
+ @line_editor.input_key(Reline::Key.new(:em_delete_or_list, :em_delete_or_list, false))
+ assert_byte_pointer_size('foo')
+ assert_cursor(3)
+ assert_cursor_max(3)
+ assert_line('foo')
+ assert_equal(%w{foo_foo foo_bar foo_baz}, @line_editor.instance_variable_get(:@menu_info).list)
+ end
+
def test_completion
@line_editor.completion_proc = proc { |word|
%w{