]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0893: No test that undofile format does not regress v9.1.0893
authorChristian Brabandt <cb@256bit.org>
Thu, 28 Nov 2024 20:59:33 +0000 (21:59 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 28 Nov 2024 20:59:33 +0000 (21:59 +0100)
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>
Filelist
src/testdir/samples/test_undo.txt [new file with mode: 0644]
src/testdir/samples/test_undo.txt.undo [new file with mode: 0644]
src/testdir/test_undo.vim
src/version.c

index c5b1b3910c348b69f54ad88c7678c2f5dbacb656..caac66cdbd05c831e1895325ca0c2c6ecafad9e6 100644 (file)
--- a/Filelist
+++ b/Filelist
@@ -224,6 +224,7 @@ SRC_ALL =   \
                src/testdir/samples/*.vim \
                src/testdir/samples/test000 \
                src/testdir/samples/test.zip \
+               src/testdir/samples/test_undo.txt.undo \
                src/testdir/samples/testa.zip \
                src/testdir/color_ramp.vim \
                src/testdir/silent.wav \
diff --git a/src/testdir/samples/test_undo.txt b/src/testdir/samples/test_undo.txt
new file mode 100644 (file)
index 0000000..4cb29ea
--- /dev/null
@@ -0,0 +1,3 @@
+one
+two
+three
diff --git a/src/testdir/samples/test_undo.txt.undo b/src/testdir/samples/test_undo.txt.undo
new file mode 100644 (file)
index 0000000..393af7f
Binary files /dev/null and b/src/testdir/samples/test_undo.txt.undo differ
index 2e598d35c2e9fcf749eb7ebb5d4b6c0c7cd687a0..75ee4a5db31801263772f01bee7dddbd32ac3950 100644 (file)
@@ -884,4 +884,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
index d5a7899d7165459b70e58ad5d2feb2f4a917b79c..8c4afd039236b3fee55616bb71e4240b9ffd4bcc 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    893,
 /**/
     892,
 /**/