aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/edit_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-16 21:56:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-16 22:46:54 +0800
commit0cfd4fa8f3dc2241de5f69d5c52510542dfc927c (patch)
tree0a7a764842acb866073ad177f5afc5bcaed3bd9c /test/functional/legacy/edit_spec.lua
parent780edfc0eb1293f5813d904ad61fc65bbbb41784 (diff)
downloadrneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.tar.gz
rneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.tar.bz2
rneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.zip
vim-patch:8.2.2643: various code not covered by tests
Problem: Various code not covered by tests. Solution: Add a few more test. (Yegappan Lakshmanan, closes vim/vim#7995) https://github.com/vim/vim/commit/1f448d906b3c516e5864dc5bae3ddbf3664ee649 Cherry-pick some test_edit.vim changes from patches 8.2.{1022,1432}. Reorder test_undo.vim to match upstream.
Diffstat (limited to 'test/functional/legacy/edit_spec.lua')
-rw-r--r--test/functional/legacy/edit_spec.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/legacy/edit_spec.lua b/test/functional/legacy/edit_spec.lua
new file mode 100644
index 0000000000..7fc5f11a79
--- /dev/null
+++ b/test/functional/legacy/edit_spec.lua
@@ -0,0 +1,26 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear = helpers.clear
+local command = helpers.command
+local expect = helpers.expect
+local feed = helpers.feed
+local sleep = helpers.sleep
+
+before_each(clear)
+
+-- oldtest: Test_autoindent_remove_indent()
+it('autoindent removes indent when Insert mode is stopped', function()
+ command('set autoindent')
+ -- leaving insert mode in a new line with indent added by autoindent, should
+ -- remove the indent.
+ feed('i<Tab>foo<CR><Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ -- when a line is wrapped and the cursor is at the start of the second line,
+ -- leaving insert mode, should move the cursor back to the first line.
+ feed('o' .. ('x'):rep(20) .. '<Esc>')
+ -- Need to delay for sometime, otherwise the code in getchar.c will not be
+ -- exercised.
+ sleep(50)
+ expect('\tfoo\n\n' .. ('x'):rep(20))
+end)