mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.0012: some undo functionality is not tested
Problem: Some undo functionality is not tested. Solution: Add a few more test cases. (Dominique Pelle, closes #5364)
This commit is contained in:
parent
5e5a98d7de
commit
559b9c68fe
@ -249,6 +249,26 @@ func Test_undojoin_redo()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" undojoin not allowed after undo
|
||||||
|
func Test_undojoin_after_undo()
|
||||||
|
new
|
||||||
|
call feedkeys("ixx\<Esc>u", 'xt')
|
||||||
|
call assert_fails(':undojoin', 'E790:')
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" undojoin is a noop when no change yet, or when 'undolevels' is negative
|
||||||
|
func Test_undojoin_noop()
|
||||||
|
new
|
||||||
|
call feedkeys(":undojoin\<CR>", 'xt')
|
||||||
|
call assert_equal([''], getline(1, '$'))
|
||||||
|
setlocal undolevels=-1
|
||||||
|
call feedkeys("ixx\<Esc>u", 'xt')
|
||||||
|
call feedkeys(":undojoin\<CR>", 'xt')
|
||||||
|
call assert_equal(['xx'], getline(1, '$'))
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_undo_write()
|
func Test_undo_write()
|
||||||
call delete('Xtest')
|
call delete('Xtest')
|
||||||
split Xtest
|
split Xtest
|
||||||
@ -335,7 +355,14 @@ func Test_undofile_earlier()
|
|||||||
call delete('Xundofile')
|
call delete('Xundofile')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Check that reading a truncted undo file doesn't hang.
|
func Test_wundo_errors()
|
||||||
|
new
|
||||||
|
call setline(1, 'hello')
|
||||||
|
call assert_fails('wundo! Xdoesnotexist/Xundofile', 'E828:')
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" Check that reading a truncated undo file doesn't hang.
|
||||||
func Test_undofile_truncated()
|
func Test_undofile_truncated()
|
||||||
new
|
new
|
||||||
call setline(1, 'hello')
|
call setline(1, 'hello')
|
||||||
@ -353,6 +380,15 @@ func Test_undofile_truncated()
|
|||||||
call delete('Xundofile')
|
call delete('Xundofile')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_rundo_errors()
|
||||||
|
call assert_fails('rundo XfileDoesNotExist', 'E822:')
|
||||||
|
|
||||||
|
call writefile(['abc'], 'Xundofile')
|
||||||
|
call assert_fails('rundo Xundofile', 'E823:')
|
||||||
|
|
||||||
|
call delete('Xundofile')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for undo working properly when executing commands from a register.
|
" Test for undo working properly when executing commands from a register.
|
||||||
" Also test this in an empty buffer.
|
" Also test this in an empty buffer.
|
||||||
func Test_cmd_in_reg_undo()
|
func Test_cmd_in_reg_undo()
|
||||||
@ -422,6 +458,24 @@ func Test_undo_0()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" undo or redo are noop if there is nothing to undo or redo
|
||||||
|
func Test_undo_redo_noop()
|
||||||
|
new
|
||||||
|
call assert_fails('undo 2', 'E830:')
|
||||||
|
|
||||||
|
message clear
|
||||||
|
undo
|
||||||
|
let messages = split(execute('message'), "\n")
|
||||||
|
call assert_equal('Already at oldest change', messages[-1])
|
||||||
|
|
||||||
|
message clear
|
||||||
|
redo
|
||||||
|
let messages = split(execute('message'), "\n")
|
||||||
|
call assert_equal('Already at newest change', messages[-1])
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_redo_empty_line()
|
func Test_redo_empty_line()
|
||||||
new
|
new
|
||||||
exe "norm\x16r\x160"
|
exe "norm\x16r\x160"
|
||||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
12,
|
||||||
/**/
|
/**/
|
||||||
11,
|
11,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user