]> granicus.if.org Git - vim/commitdiff
patch 8.2.2837: various code lines not covered by tests v8.2.2837
authorDominique Pelle <dominique.pelle@gmail.com>
Thu, 6 May 2021 15:36:55 +0000 (17:36 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 6 May 2021 15:36:55 +0000 (17:36 +0200)
Problem:    Various code lines not covered by tests.
Solution:   Add test cases. (Dominique PellĂ©, closes #8178)

src/testdir/test_excmd.vim
src/testdir/test_functions.vim
src/testdir/test_options.vim
src/testdir/test_startup.vim
src/testdir/test_syntax.vim
src/testdir/test_vim9_cmd.vim
src/version.c

index f830be8a4a2b913c284daa8cff00d3605d17233b..2e137f0e61679f1113b29a6d3c3bec869a3922c2 100644 (file)
@@ -591,4 +591,10 @@ func Test_sandbox()
   sandbox call Sandbox_tests()
 endfunc
 
+func Test_command_not_implemented_E319()
+  if !has('mzscheme')
+    call assert_fails('mzscheme', 'E319:')
+  endif
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 1cce8a0b19a45bacf573b5e84a17cb7819dae855..936a2d06090071ef851e26b39c0a595dad1e4a15 100644 (file)
@@ -1148,7 +1148,9 @@ func Test_charidx()
   call assert_equal(2, charidx(a, 4))
   call assert_equal(3, charidx(a, 7))
   call assert_equal(-1, charidx(a, 8))
+  call assert_equal(-1, charidx(a, -1))
   call assert_equal(-1, charidx('', 0))
+  call assert_equal(-1, charidx(test_null_string(), 0))
 
   " count composing characters
   call assert_equal(0, charidx(a, 0, 1))
index 54042d42f70ad44190e1d86b8c10e469a0d01d10..d789a461eaeba756701a52def2a55c9de994adca 100644 (file)
@@ -1093,4 +1093,32 @@ func Test_opt_reset_scroll()
   call delete('Xscroll')
 endfunc
 
+" Check that VIM_POSIX env variable influences default value of 'cpo' and 'shm'
+func Test_VIM_POSIX()
+  let saved_VIM_POSIX = getenv("VIM_POSIX")
+
+  call setenv('VIM_POSIX', "1")
+  let after =<< trim [CODE]
+    call writefile([&cpo, &shm], 'X_VIM_POSIX')
+    qall
+  [CODE]
+  if RunVim([], after, '')
+    call assert_equal(['aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>#{|&/\.;',
+          \            'AS'], readfile('X_VIM_POSIX'))
+  endif
+
+  call setenv('VIM_POSIX', v:null)
+  let after =<< trim [CODE]
+    call writefile([&cpo, &shm], 'X_VIM_POSIX')
+    qall
+  [CODE]
+  if RunVim([], after, '')
+    call assert_equal(['aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;',
+          \            'S'], readfile('X_VIM_POSIX'))
+  endif
+
+  call delete('X_VIM_POSIX')
+  call setenv('VIM_POSIX', saved_VIM_POSIX)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 2d5fdcb246479fab568c0538b23afa7b8295603c..6e814704a1a92130eab1a0f4522f01318d5e1ff3 100644 (file)
@@ -622,6 +622,12 @@ func Test_invalid_args()
   endfor
 
   if has('gui_gtk')
+    let out = split(system(GetVimCommand() .. ' --socketid'), "\n")
+    call assert_equal(1, v:shell_error)
+    call assert_match('^VIM - Vi IMproved .* (.*)$',          out[0])
+    call assert_equal('Argument missing after: "--socketid"', out[1])
+    call assert_equal('More info with: "vim -h"',             out[2])
+
     for opt in ['--socketid x', '--socketid 0xg']
       let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
       call assert_equal(1, v:shell_error)
@@ -629,6 +635,7 @@ func Test_invalid_args()
       call assert_equal('Invalid argument for: "--socketid"', out[1])
       call assert_equal('More info with: "vim -h"',           out[2])
     endfor
+
   endif
 endfunc
 
index bc268a14bb533cb0f6fa52997291c976dc52263a..0a0d667311b1d1410c40c38118d5e717378c30dc 100644 (file)
@@ -111,6 +111,9 @@ func Test_syntime()
   let a = execute('syntime report')
   call assert_equal("\nNo Syntax items defined for this buffer", a)
 
+  let a = execute('syntime clear')
+  call assert_equal("\nNo Syntax items defined for this buffer", a)
+
   view ../memfile_test.c
   setfiletype cpp
   redraw
index 1e1a498bf69553eace039d3bd156f82c88fe5eef..080fe20cc1e0abb561bfae280d5bffcac075b13e 100644 (file)
@@ -13,6 +13,7 @@ def Test_vim9cmd()
     vim9cm assert_equal('yes', y)
   END
   CheckScriptSuccess(lines)
+  assert_fails('vim9cmd', 'E1164:')
 enddef
 
 def Test_edit_wildcards()
index 5ef8d7cc06fc490242105d5757b5405d9927922f..d9c6540a9bb24eca913a46927071d665d1dda9eb 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2837,
 /**/
     2836,
 /**/