]> granicus.if.org Git - vim/commitdiff
patch 8.2.2592: code coverage could be improved v8.2.2592
authorBram Moolenaar <Bram@vim.org>
Sat, 13 Mar 2021 12:14:04 +0000 (13:14 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 13 Mar 2021 12:14:04 +0000 (13:14 +0100)
Problem:    Code coverage could be improved.
Solution:   Add a few more tests. (Dominique PellĂ©, closes #7957)

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

index 09be2582216bee73c39bd5462539d87e31cd6e94..07819dc2e65d533a00581e08f71b1d997516d51f 100644 (file)
@@ -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')
index 8aef41ddda2c3c29f404e3e6fa5149e72d1e201d..75b52bcb6e968b25e0989efc7f68d9e03b9fb56c 100644 (file)
@@ -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
 
index f71855fd4bce948c7642a1625530b8807b0ebb9f..a428f380b0d042ca9047cbfa59fb1a38c3590c50 100644 (file)
@@ -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
index eac1c1980ab0025164a6e81a5ccaacf3574096cc..32ff3cc70b1ed979ae3288db58622a18a55c1383 100644 (file)
@@ -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
index cb090ce5ce345bc75908b7303795139bd04e9f7a..ef74e09dbdc6f53092efe954bccbecda8ba1d54b 100644 (file)
@@ -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
index 76a95b9b6c10ad6f80d43d16e811ceee0dac1eeb..c6866a2973668385d99d71cbc7a28100b7c0e420 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2592,
 /**/
     2591,
 /**/