diff src/testdir/test_options.vim @ 24596:acd9220bdd0b v8.2.2837

patch 8.2.2837: various code lines not covered by tests Commit: https://github.com/vim/vim/commit/6d37e8e3baafba460bd2d051170d213c1ba9a523 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Thu May 6 17:36:55 2021 +0200 patch 8.2.2837: various code lines not covered by tests Problem: Various code lines not covered by tests. Solution: Add test cases. (Dominique Pell?, closes https://github.com/vim/vim/issues/8178)
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 May 2021 17:45:04 +0200
parents 0a5eba7e6660
children 4c1b6f3eb96b
line wrap: on
line diff
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -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