Patch 8.2.0012

15 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 15, 2019, 12:10:14 PM12/15/19
to vim...@googlegroups.com

Patch 8.2.0012
Problem: Some undo functionality is not tested.
Solution: Add a few more test cases. (Dominique Pelle, closes #5364)
Files: src/testdir/test_undo.vim


*** ../vim-8.2.0011/src/testdir/test_undo.vim 2019-12-14 20:34:37.359112536 +0100
--- src/testdir/test_undo.vim 2019-12-15 18:06:14.074121873 +0100
***************
*** 249,254 ****
--- 249,274 ----
bwipe!
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()
call delete('Xtest')
split Xtest
***************
*** 335,341 ****
call delete('Xundofile')
endfunc

! " Check that reading a truncted undo file doesn't hang.
func Test_undofile_truncated()
new
call setline(1, 'hello')
--- 355,368 ----
call delete('Xundofile')
endfunc

! 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()
new
call setline(1, 'hello')
***************
*** 353,358 ****
--- 380,394 ----
call delete('Xundofile')
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.
" Also test this in an empty buffer.
func Test_cmd_in_reg_undo()
***************
*** 421,426 ****
--- 457,480 ----

bwipe!
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()
new
*** ../vim-8.2.0011/src/version.c 2019-12-15 14:54:17.609139105 +0100
--- src/version.c 2019-12-15 18:07:32.925877345 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 12,
/**/

--
Error:015 - Unable to exit Windows. Try the door.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages