Patch 8.2.0665
Problem: Wrongly assuming Python executable is called "python".
Solution: Use detected python command. (Ken Takata, closes #6016)
Also use CheckFunction if possible.
Files: src/testdir/test_terminal.vim, src/testdir/check.vim
*** ../vim-8.2.0664/src/testdir/test_terminal.vim 2020-04-26 15:59:51.206952132 +0200
--- src/testdir/test_terminal.vim 2020-04-30 19:06:52.830349912 +0200
***************
*** 715,724 ****
endfunc
func Test_terminal_eof_arg()
! CheckExecutable python
call setline(1, ['print("hello")'])
! 1term ++eof=exit(123) python
" MS-Windows echoes the input, Unix doesn't.
if has('win32')
call WaitFor({-> getline('$') =~ 'exit(123)'})
--- 715,724 ----
endfunc
func Test_terminal_eof_arg()
! call CheckPython(s:python)
call setline(1, ['print("hello")'])
! exe '1term ++eof=exit(123) ' .. s:python
" MS-Windows echoes the input, Unix doesn't.
if has('win32')
call WaitFor({-> getline('$') =~ 'exit(123)'})
***************
*** 733,754 ****
func Test_terminal_eof_arg_win32_ctrl_z()
CheckMSWindows
! CheckExecutable python
call setline(1, ['print("hello")'])
! 1term ++eof=<C-Z> python
call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))})
call assert_match('\^Z', getline(line('$') - 1))
%bwipe!
endfunc
func Test_terminal_duplicate_eof_arg()
! CheckExecutable python
" Check the last specified ++eof arg is used and should not memory leak.
new
call setline(1, ['print("hello")'])
! 1term ++eof=<C-Z> ++eof=exit(123) python
" MS-Windows echoes the input, Unix doesn't.
if has('win32')
call WaitFor({-> getline('$') =~ 'exit(123)'})
--- 733,754 ----
func Test_terminal_eof_arg_win32_ctrl_z()
CheckMSWindows
! call CheckPython(s:python)
call setline(1, ['print("hello")'])
! exe '1term ++eof=<C-Z> ' .. s:python
call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))})
call assert_match('\^Z', getline(line('$') - 1))
%bwipe!
endfunc
func Test_terminal_duplicate_eof_arg()
! call CheckPython(s:python)
" Check the last specified ++eof arg is used and should not memory leak.
new
call setline(1, ['print("hello")'])
! exe '1term ++eof=<C-Z> ++eof=exit(123) ' .. s:python
" MS-Windows echoes the input, Unix doesn't.
if has('win32')
call WaitFor({-> getline('$') =~ 'exit(123)'})
***************
*** 1571,1579 ****
endfunc
func Test_terminal_ansicolors_default()
! if !exists('*term_getansicolors')
! throw 'Skipped: term_getansicolors() not supported'
! endif
let colors = [
\ '#000000', '#e00000',
\ '#00e000', '#e0e000',
--- 1571,1578 ----
endfunc
func Test_terminal_ansicolors_default()
! CheckFunction term_getansicolors
!
let colors = [
\ '#000000', '#e00000',
\ '#00e000', '#e0e000',
***************
*** 1606,1614 ****
func Test_terminal_ansicolors_global()
CheckFeature termguicolors
! if !exists('*term_getansicolors')
! throw 'Skipped: term_getansicolors() not supported'
! endif
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({})
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
--- 1605,1612 ----
func Test_terminal_ansicolors_global()
CheckFeature termguicolors
! CheckFunction term_getansicolors
!
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({})
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
***************
*** 1621,1629 ****
func Test_terminal_ansicolors_func()
CheckFeature termguicolors
! if !exists('*term_getansicolors')
! throw 'Skipped: term_getansicolors() not supported'
! endif
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
call assert_equal(s:test_colors, term_getansicolors(buf))
--- 1619,1626 ----
func Test_terminal_ansicolors_func()
CheckFeature termguicolors
! CheckFunction term_getansicolors
!
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
call assert_equal(s:test_colors, term_getansicolors(buf))
***************
*** 2588,2593 ****
--- 2585,2591 ----
endfunc
func Test_term_nasty_callback()
+ CheckExecutable sh
func OpenTerms()
set hidden
let g:buf0 = term_start('sh', #{hidden: 1})
*** ../vim-8.2.0664/src/testdir/check.vim 2020-04-12 17:52:49.429492390 +0200
--- src/testdir/check.vim 2020-04-30 19:00:37.483570472 +0200
***************
*** 52,57 ****
--- 52,65 ----
endif
endfunc
+ " Command to check for the presence of python. Argument should have been
+ " obtained with PythonProg()
+ func CheckPython(name)
+ if a:name == ''
+ throw 'Skipped: python command not available'
+ endif
+ endfunc
+
" Command to check for running on MS-Windows
command CheckMSWindows call CheckMSWindows()
func CheckMSWindows()
*** ../vim-8.2.0664/src/version.c 2020-04-29 23:11:29.090909199 +0200
--- src/version.c 2020-04-30 19:08:45.662252834 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 665,
/**/
--
'Well, here's something to occupy you and keep your mind off things.'
'It won't work, I have an exceptionally large mind.'
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///