]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1051: tests: no support for env variables when running Vim in terminal v9.1.1051
authorChristian Brabandt <cb@256bit.org>
Sat, 25 Jan 2025 14:01:42 +0000 (15:01 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 25 Jan 2025 14:01:42 +0000 (15:01 +0100)
Problem:  tests: no support for env variables when running Vim in
          terminal
Solution: support the "env" argument in RunVimInTerminal(),
          close swapfiles properly in test_termcodes,
          use CheckFeature in test_termencoding

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/term_util.vim
src/testdir/test_termcodes.vim
src/testdir/test_termencoding.vim
src/version.c

index 1a06db7eb17dc2b53c40f1fe97ac469b836fbb10..67b21cb96261407f9d85da507c636adcb7e8bf95 100644 (file)
@@ -57,6 +57,7 @@ endfunc
 " "wait_for_ruler" - if zero then don't wait for ruler to show
 " "no_clean" - if non-zero then remove "--clean" from the command
 " "cmd"  - run any other command, e.g. "xxd" (used in xxd test)
+" "env"  - additional environment variables, e.g. $TERM variable
 func RunVimInTerminal(arguments, options)
   " If Vim doesn't exit a swap file remains, causing other tests to fail.
   " Remove it here.
@@ -109,6 +110,10 @@ func RunVimInTerminal(arguments, options)
 
   " Accept other options whose name starts with 'term_'.
   call extend(options, filter(copy(a:options), 'v:key =~# "^term_"'))
+  " Accept the env dict
+  if !empty(get(a:options, 'env', {}))
+    let options.env = get(a:options, 'env')
+  endif
 
   let buf = term_start(cmd, options)
 
index 2b44b1553519de03c1d9320b3d7fba5683d857bf..25034ed6cc7df17b71b4f000b9386378dc3a32e1 100644 (file)
@@ -301,7 +301,7 @@ func Test_term_mouse_middle_click_no_clipboard()
   let &ttymouse = save_ttymouse
   let &term = save_term
   let &mouse = save_mouse
-  close!
+  bw!
 endfunc
 
 func Test_term_mouse_middle_click_insert_mode()
@@ -370,7 +370,7 @@ func Test_term_mouse_switch_win_insert_mode()
   let &term = save_term
   let &ttymouse = save_ttymouse
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 " Test for using the mouse to increase the height of the cmdline window
@@ -1051,7 +1051,7 @@ func Test_mouse_alt_leftclick()
   let &ttymouse = save_ttymouse
   set mousetime& mousemodel&
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 func Test_xterm_mouse_click_in_fold_columns()
@@ -1276,7 +1276,7 @@ func Test_term_mouse_visual_mode()
   let &term = save_term
   let &ttymouse = save_ttymouse
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 " Test for displaying the popup menu using the right mouse click
@@ -1311,7 +1311,7 @@ func Test_term_mouse_popup_menu()
   let &ttymouse = save_ttymouse
   let &mousemodel = save_mousemodel
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 " Test for 'mousemodel' set to popup_setpos to move the cursor where the popup
@@ -1437,7 +1437,7 @@ func Test_term_mouse_popup_menu_setpos()
   let &ttymouse = save_ttymouse
   let &mousemodel = save_mousemodel
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 " Test for searching for the word under the cursor using Shift-Right or
@@ -1476,7 +1476,7 @@ func Test_term_mouse_search()
   let &term = save_term
   let &ttymouse = save_ttymouse
   call test_override('no_query_mouse', 0)
-  close!
+  bw!
 endfunc
 
 " Test for selecting an entry in the quickfix/location list window using the
@@ -2739,5 +2739,4 @@ func Test_terminal_builtin_without_gui()
   call assert_notequal(-1, index(output, 'builtin_dumb'))
 endfunc
 
-
 " vim: shiftwidth=2 sts=2 expandtab
index de812ce0a79899ea2b5466a47fd3c982bdc8eb34..9b7f487ba0d5f0e8bca3957c183431417b4caa37 100644 (file)
@@ -1,10 +1,10 @@
 " Test for setting 'encoding' to something else than the terminal uses, then
 " setting 'termencoding' to make it work.
 
+source check.vim
+
 " This only works with "iconv".
-if !has('iconv')
-  throw 'Skipped: iconv feature missing'
-endif
+CheckFeature iconv
 
 source screendump.vim
 if !CanRunVimInTerminal()
index 53cecb34600a8abc07c99a044a4b11d10a56f57d..235c4f328d113470ef44adf1bdbb254172f08729 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1051,
 /**/
     1050,
 /**/