aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_undo.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-05 20:31:19 -0400
committerGitHub <noreply@github.com>2020-10-05 20:31:19 -0400
commitf8a5b4bdce489f4df7df15d0b363b608853b92d6 (patch)
treef376500b5b2225d0d98871d3ab981a0e590ae31b /src/nvim/testdir/test_undo.vim
parentc76fc7942b3a88b90c6f0bc7fafabe1f55c7814e (diff)
parent674844086b0bc76a8878c6365323afbdb08580d4 (diff)
downloadrneovim-f8a5b4bdce489f4df7df15d0b363b608853b92d6.tar.gz
rneovim-f8a5b4bdce489f4df7df15d0b363b608853b92d6.tar.bz2
rneovim-f8a5b4bdce489f4df7df15d0b363b608853b92d6.zip
Merge pull request #13039 from janlazo/vim-8.2.1790
vim-patch:8.1.{1812,2024,2239,2242,2247,2249,2253},8.2.{354,603,609,665,1570,1790,1792,1801}
Diffstat (limited to 'src/nvim/testdir/test_undo.vim')
-rw-r--r--src/nvim/testdir/test_undo.vim39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim
index adcdcb1cd9..3b66071d6d 100644
--- a/src/nvim/testdir/test_undo.vim
+++ b/src/nvim/testdir/test_undo.vim
@@ -364,6 +364,25 @@ func Test_wundo_errors()
bwipe!
endfunc
+" Check that reading a truncted undo file doesn't hang.
+func Test_undofile_truncated()
+ throw 'skipped: TODO: '
+ 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
+
func Test_rundo_errors()
call assert_fails('rundo XfileDoesNotExist', 'E822:')
@@ -373,6 +392,26 @@ func Test_rundo_errors()
call delete('Xundofile')
endfunc
+func Test_undofile_next()
+ set undofile
+ new Xfoo.txt
+ execute "norm ix\<c-g>uy\<c-g>uz\<Esc>"
+ write
+ bwipe
+
+ next Xfoo.txt
+ call assert_equal('xyz', getline(1))
+ silent undo
+ call assert_equal('xy', getline(1))
+ silent undo
+ call assert_equal('x', getline(1))
+ bwipe!
+
+ call delete('Xfoo.txt')
+ call delete('.Xfoo.txt.un~')
+ set undofile&
+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()