diff options
author | Jonathan Slenders <jonathan@slenders.be> | 2016-07-30 16:41:54 +0200 |
---|---|---|
committer | Jonathan Slenders <jonathan@slenders.be> | 2016-07-30 16:41:56 +0200 |
commit | e872f177604620e5a531dda13451c12ae5b81e6b (patch) | |
tree | bdbaeed154e9f2ab55ae237fc61445f20cbafe25 | |
parent | a2fcaec29858dd1c20250c05db849c9eeb485883 (diff) |
Added unit tests for emacs arguments.
-rw-r--r-- | tests/test_cli.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py index 29725aab..c558c96f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -302,6 +302,31 @@ def test_emacs_reverse_search(): def test_emacs_arguments(): """ + Test various combinations of arguments in Emacs mode. + """ + # esc 4 + result, cli = _feed_cli_with_input('\x1b4x\n') + assert result.text == 'xxxx' + + # esc 4 4 + result, cli = _feed_cli_with_input('\x1b44x\n') + assert result.text == 'x' * 44 + + # esc - right (-1 position to the right, equals 1 to the left.) + result, cli = _feed_cli_with_input('aaaa\x1b-\x1b[Cbbbb\n') + assert result.text == 'aaabbbba' + + # esc - 3 right + result, cli = _feed_cli_with_input('aaaa\x1b-3\x1b[Cbbbb\n') + assert result.text == 'abbbbaaa' + + # esc - - - 3 right + result, cli = _feed_cli_with_input('aaaa\x1b---3\x1b[Cbbbb\n') + assert result.text == 'abbbbaaa' + + +def test_emacs_arguments_for_all_commands(): + """ Test all Emacs commands with Meta-[0-9] arguments (both positive and negative). No one should crash. """ |