neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 94f7302e66965374c5b60f54c5e4b4f40b5a9c53
parent ab20681c5229df3dc7291c67bb5a944acb7d5f7f
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  2 Jan 2026 07:05:48 +0800

vim-patch:9.1.0893: No test that undofile format does not regress (#37193)

Problem:  No test that undofile format does not regress
Solution: include a sample undofile to make sure we are always able to
          read it

This is so, that we don't unintentionally change the undofile format and
make sure we can load an undo file that has been created by an older
Vim.

closes: vim/vim#16127

https://github.com/vim/vim/commit/14382c8bc96cc8f3985a01ab58c2f4d7b4d9ec85

Convert the undo file in samples/ using method from #13973.

Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat:
Atest/old/testdir/samples/test_undo.txt | 3+++
Atest/old/testdir/samples/test_undo.txt.undo | 0
Mtest/old/testdir/test_undo.vim | 29+++++++++++++++++++++++++++++
3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/test/old/testdir/samples/test_undo.txt b/test/old/testdir/samples/test_undo.txt @@ -0,0 +1,3 @@ +one +two +three diff --git a/test/old/testdir/samples/test_undo.txt.undo b/test/old/testdir/samples/test_undo.txt.undo Binary files differ. diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim @@ -883,4 +883,33 @@ func Test_undo_range_normal() bwipe! endfunc +func Test_load_existing_undofile() + CheckFeature persistent_undo + sp samples/test_undo.txt + let mess=execute(':verbose rundo samples/test_undo.txt.undo') + call assert_match('Finished reading undo file', mess) + + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + norm! u + call assert_equal(['one', 'two'], getline(1, '$')) + norm! u + call assert_equal(['one'], getline(1, '$')) + norm! u + call assert_equal([''], getline(1, '$')) + let mess = execute(':norm! u') + call assert_equal([''], getline(1, '$')) + call assert_match('Already at oldest change', mess) + exe ":norm! \<c-r>" + call assert_equal(['one'], getline(1, '$')) + exe ":norm! \<c-r>" + call assert_equal(['one', 'two'], getline(1, '$')) + exe ":norm! \<c-r>" + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + let mess = execute(":norm! \<c-r>") + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + call assert_match('Already at newest change', mess) + bw! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab