diff options
author | aycabta <aycabta@gmail.com> | 2019-05-29 10:04:39 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-29 10:04:58 +0900 |
commit | 3f132979236f4aa42e3347a920123ce271a1e695 (patch) | |
tree | c2b1362a7e06a79439818dbf8e1dc5dad3e06d13 /test/reline/test_key_actor_emacs.rb | |
parent | c86d1fbed5e887ea7b59582510fb26ec912b7898 (diff) | |
download | ruby-3f132979236f4aa42e3347a920123ce271a1e695.tar.gz |
Remove extra items because Reline::HISTORY is a sized queue
Diffstat (limited to 'test/reline/test_key_actor_emacs.rb')
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index 5778677ad8..81bff17967 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -5,6 +5,7 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase Reline.send(:test_mode) @prompt = '> ' @config = Reline::Config.new # Emacs mode is default + Reline::HISTORY.send(:set_config, @config) @encoding = (RELINE_TEST_ENCODING rescue Encoding.default_external) @line_editor = Reline::LineEditor.new(@config) @line_editor.reset(@prompt, @encoding) @@ -1181,6 +1182,33 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_cursor_max(3) end + def test_larger_histories_than_history_size + history_size = @config.history_size + @config.history_size = 2 + Reline::HISTORY.concat(%w{abc 123 AAA}) + assert_line('') + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + input_keys("\C-p") + assert_line('AAA') + assert_byte_pointer_size('AAA') + assert_cursor(3) + assert_cursor_max(3) + input_keys("\C-p") + assert_line('123') + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(3) + input_keys("\C-p") + assert_line('123') + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(3) + ensure + @config.history_size = history_size + end + =begin # TODO: move KeyStroke instance from Reline to LineEditor def test_key_delete input_keys('ab') |