diff options
author | aycabta <[email protected]> | 2020-04-17 04:38:47 +0900 |
---|---|---|
committer | aycabta <[email protected]> | 2020-04-18 23:12:52 +0900 |
commit | db0d850d4eac5577104e6d0f22950d97f53c5a13 (patch) | |
tree | 00b7969448a0ceb9e8a2d97b6d0270064378964c /test/reline/test_key_actor_emacs.rb | |
parent | bea3e31e5f8b85f0665b94312418f97e71c14fc6 (diff) |
[ruby/reline] Add ed_search_next_history
https://github.com/ruby/reline/commit/ca750b676b
Diffstat (limited to 'test/reline/test_key_actor_emacs.rb')
-rw-r--r-- | test/reline/test_key_actor_emacs.rb | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb index a5de605314..a1e4015999 100644 --- a/test/reline/test_key_actor_emacs.rb +++ b/test/reline/test_key_actor_emacs.rb @@ -1981,6 +1981,80 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase assert_line('ABC') end + def test_ed_search_next_history + Reline::HISTORY.concat([ + '12356', # old + '12aaa', + '12345' # new + ]) + input_keys('123') + # The ed_search_prev_history and ed_search_next_history doesn't have default binding + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(5) + assert_line('12345') + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(5) + assert_line('12356') + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(5) + assert_line('12356') + @line_editor.__send__(:ed_search_next_history, "\C-n".ord) + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(5) + assert_line('12345') + @line_editor.__send__(:ed_search_next_history, "\C-n".ord) + assert_byte_pointer_size('123') + assert_cursor(3) + assert_cursor_max(5) + assert_line('12345') + end + + def test_ed_search_next_history_with_empty + Reline::HISTORY.concat([ + '12356', # old + '12aaa', + '12345' # new + ]) + # The ed_search_prev_history and ed_search_next_history doesn't have default binding + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(5) + assert_line('12345') + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(5) + assert_line('12aaa') + @line_editor.__send__(:ed_search_prev_history, "\C-p".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(5) + assert_line('12356') + @line_editor.__send__(:ed_search_next_history, "\C-n".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(5) + assert_line('12aaa') + @line_editor.__send__(:ed_search_next_history, "\C-n".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(5) + assert_line('12345') + @line_editor.__send__(:ed_search_next_history, "\C-n".ord) + assert_byte_pointer_size('') + assert_cursor(0) + assert_cursor_max(0) + assert_line('') + end + =begin # TODO: move KeyStroke instance from Reline to LineEditor def test_key_delete input_keys('ab') |