summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Slenders <jonathan@slenders.be>2016-08-21 21:14:00 +0200
committerJonathan Slenders <jonathan@slenders.be>2016-08-21 21:14:00 +0200
commitc05010b094fe301c028808e2a51bc40bf0b83713 (patch)
treec6e76f673deb06f22652fdb6c1c68fd31f69160d
parent316e28702c155ec636e8197acc65878b341ba9a9 (diff)
Added unit tests for forward/backward-word operations with negative arguments.
-rw-r--r--tests/test_cli.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 99a05ad2..32bca469 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -145,6 +145,22 @@ def test_emacs_cursor_movements():
result, cli = _feed_cli_with_input('hello world\x1b[1;5DY\n')
assert result.text == 'hello Yworld'
+ # <esc>-f with argument. (forward-word)
+ result, cli = _feed_cli_with_input('hello world abc def\x01\x1b3\x1bfX\n')
+ assert result.text == 'hello world abcX def'
+
+ # <esc>-f with negative argument. (forward-word)
+ result, cli = _feed_cli_with_input('hello world abc def\x1b-\x1b3\x1bfX\n')
+ assert result.text == 'hello Xworld abc def'
+
+ # <esc>-b with argument. (backward-word)
+ result, cli = _feed_cli_with_input('hello world abc def\x1b3\x1bbX\n')
+ assert result.text == 'hello Xworld abc def'
+
+ # <esc>-b with negative argument. (backward-word)
+ result, cli = _feed_cli_with_input('hello world abc def\x01\x1b-\x1b3\x1bbX\n')
+ assert result.text == 'hello world abc Xdef'
+
# ControlW (kill-word / unix-word-rubout)
result, cli = _feed_cli_with_input('hello world\x17\n')
assert result.text == 'hello '