0
0
mirror of https://github.com/vim/vim.git synced 2025-10-18 07:54:29 -04:00

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 #7995)
This commit is contained in:
Bram Moolenaar
2021-03-22 19:37:06 +01:00
parent e98f60a591
commit 1f448d906b
6 changed files with 83 additions and 1 deletions

View File

@@ -411,6 +411,33 @@ func Test_edit_13()
bwipe!
endfunc
" Test for autoindent removing indent when insert mode is stopped. Some parts
" of the code is exercised only when interactive mode is used. So use Vim in a
" terminal.
func Test_autoindent_remove_indent()
CheckRunVimInTerminal
let buf = RunVimInTerminal('-N Xfile', {'rows': 6, 'cols' : 20})
call TermWait(buf)
call term_sendkeys(buf, ":set autoindent\n")
" leaving insert mode in a new line with indent added by autoindent, should
" remove the indent.
call term_sendkeys(buf, "i\<Tab>foo\<CR>\<Esc>")
" Need to delay for sometime, otherwise the code in getchar.c will not be
" exercised.
call TermWait(buf, 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.
call term_sendkeys(buf, "o" .. repeat('x', 20) .. "\<Esc>")
" Need to delay for sometime, otherwise the code in getchar.c will not be
" exercised.
call TermWait(buf, 50)
call term_sendkeys(buf, ":w\n")
call TermWait(buf)
call StopVimInTerminal(buf)
call assert_equal(["\tfoo", '', repeat('x', 20)], readfile('Xfile'))
call delete('Xfile')
endfunc
func Test_edit_CR()
" Test for <CR> in insert mode
" basically only in quickfix mode ist tested, the rest