changeset 24101:6d3dee0d7de5 v8.2.2592

patch 8.2.2592: code coverage could be improved Commit: https://github.com/vim/vim/commit/6fd367a97c8653a2d734a38252c7d68d4b2ebaa7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 13 13:14:04 2021 +0100 patch 8.2.2592: code coverage could be improved Problem: Code coverage could be improved. Solution: Add a few more tests. (Dominique Pell?, closes https://github.com/vim/vim/issues/7957)
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Mar 2021 13:15:03 +0100
parents 37801c4fe1a4
children f897c1862d9e
files src/testdir/test_fileformat.vim src/testdir/test_normal.vim src/testdir/test_sleep.vim src/testdir/test_textformat.vim src/testdir/test_viminfo.vim src/version.c
diffstat 6 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_fileformat.vim
+++ b/src/testdir/test_fileformat.vim
@@ -33,6 +33,15 @@ func Test_fileformat_autocommand()
   bw!
 endfunc
 
+func Test_fileformat_nomodifiable()
+  new
+  setlocal nomodifiable
+
+  call assert_fails('set fileformat=latin1', 'E21:')
+
+  bw
+endfunc
+
 " Convert the contents of a file into a literal string
 func s:file2str(fname)
   let b = readfile(a:fname, 'B')
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -3207,6 +3207,13 @@ func Test_normal_delete_cmd()
   " delete to a readonly register
   call setline(1, ['abcd'])
   call assert_beeps('normal ":d2l')
+
+  " D and d with 'nomodifiable'
+  call setline(1, ['abcd'])
+  setlocal nomodifiable
+  call assert_fails('normal D', 'E21:')
+  call assert_fails('normal d$', 'E21:')
+
   close!
 endfunc
 
--- a/src/testdir/test_sleep.vim
+++ b/src/testdir/test_sleep.vim
@@ -21,6 +21,7 @@ func! Test_sleep_bang()
   call s:assert_takes_longer('sl 50m', 50)
   call s:assert_takes_longer('sl! 50m', 50)
   call s:assert_takes_longer('1sleep', 1000)
+  call s:assert_takes_longer('normal 1gs', 1000)
 endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -858,6 +858,21 @@ func Test_mps_latin1()
   close!
 endfunc
 
+func Test_mps_error()
+  let encoding_save = &encoding
+
+  for e in ['utf-8', 'latin1']
+    exe 'set encoding=' .. e
+
+    call assert_fails('set mps=<:', 'E474:', e)
+    call assert_fails('set mps=:>', 'E474:', e)
+    call assert_fails('set mps=<>', 'E474:', e)
+    call assert_fails('set mps=<:>_', 'E474:', e)
+  endfor
+
+  let &encoding = encoding_save
+endfunc
+
 " Test for ra on multi-byte characters
 func Test_ra_multibyte()
   new
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -906,6 +906,10 @@ func Test_viminfo_oldfiles_newfile()
   call delete('Xviminfofile')
   call delete('Xviminfotest')
   call delete('Xnew-file.txt')
+
+  let v:oldfiles = test_null_list()
+  call assert_equal("\nNo old files", execute('oldfiles'))
+
   let &viminfo = save_viminfo
   let &viminfofile = save_viminfofile
 endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2592,
+/**/
     2591,
 /**/
     2590,