Skip to content

Commit 14382c8

Browse files
committed
patch 9.1.0893: No test that undofile format does not regress
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: #16127 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 3d670bb commit 14382c8

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

Filelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ SRC_ALL = \
224224
src/testdir/samples/*.vim \
225225
src/testdir/samples/test000 \
226226
src/testdir/samples/test.zip \
227+
src/testdir/samples/test_undo.txt.undo \
227228
src/testdir/samples/testa.zip \
228229
src/testdir/color_ramp.vim \
229230
src/testdir/silent.wav \

src/testdir/samples/test_undo.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
one
2+
two
3+
three
1.37 KB
Binary file not shown.

src/testdir/test_undo.vim

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,4 +884,33 @@ func Test_undo_range_normal()
884884
bwipe!
885885
endfunc
886886

887+
func Test_load_existing_undofile()
888+
CheckFeature persistent_undo
889+
sp samples/test_undo.txt
890+
let mess=execute(':verbose rundo samples/test_undo.txt.undo')
891+
call assert_match('Finished reading undo file', mess)
892+
893+
call assert_equal(['one', 'two', 'three'], getline(1, '$'))
894+
norm! u
895+
call assert_equal(['one', 'two'], getline(1, '$'))
896+
norm! u
897+
call assert_equal(['one'], getline(1, '$'))
898+
norm! u
899+
call assert_equal([''], getline(1, '$'))
900+
let mess = execute(':norm! u')
901+
call assert_equal([''], getline(1, '$'))
902+
call assert_match('Already at oldest change', mess)
903+
exe ":norm! \<c-r>"
904+
call assert_equal(['one'], getline(1, '$'))
905+
exe ":norm! \<c-r>"
906+
call assert_equal(['one', 'two'], getline(1, '$'))
907+
exe ":norm! \<c-r>"
908+
call assert_equal(['one', 'two', 'three'], getline(1, '$'))
909+
let mess = execute(":norm! \<c-r>")
910+
call assert_equal(['one', 'two', 'three'], getline(1, '$'))
911+
call assert_match('Already at newest change', mess)
912+
bw!
913+
endfunc
914+
915+
887916
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
893,
707709
/**/
708710
892,
709711
/**/

0 commit comments

Comments
 (0)