diff src/testdir/test_undo.vim @ 17630:380adf86bf66 v8.1.1812

patch 8.1.1812: reading a truncted undo file hangs Vim commit https://github.com/vim/vim/commit/fb06d767a8d76eead5391302fc88115d6e3879d8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 4 18:55:35 2019 +0200 patch 8.1.1812: reading a truncted undo file hangs Vim Problem: Reading a truncted undo file hangs Vim. Solution: Check for reading EOF. (closes https://github.com/vim/vim/issues/4769)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Aug 2019 19:00:04 +0200
parents 16a698aeeec1
children 11dca9732a48
line wrap: on
line diff
--- a/src/testdir/test_undo.vim
+++ b/src/testdir/test_undo.vim
@@ -335,6 +335,24 @@ func Test_undofile_earlier()
   call delete('Xundofile')
 endfunc
 
+" Check that reading a truncted undo file doesn't hang.
+func Test_undofile_truncated()
+  new
+  call setline(1, 'hello')
+  set ul=100
+  wundo Xundofile
+  let contents = readfile('Xundofile', 'B')
+
+  " try several sizes
+  for size in range(20, 500, 33)
+    call writefile(contents[0:size], 'Xundofile')
+    call assert_fails('rundo Xundofile', 'E825:')
+  endfor
+
+  bwipe!
+"  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()