forked from aniani/vim
patch 8.2.0665: wrongly assuming Python executable is called "python"
Problem: Wrongly assuming Python executable is called "python". Solution: Use detected python command. (Ken Takata, closes #6016) Also use CheckFunction if possible.
This commit is contained in:
@@ -52,6 +52,14 @@ func CheckExecutable(name)
|
|||||||
endif
|
endif
|
||||||
endfunc
|
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 to check for running on MS-Windows
|
||||||
command CheckMSWindows call CheckMSWindows()
|
command CheckMSWindows call CheckMSWindows()
|
||||||
func CheckMSWindows()
|
func CheckMSWindows()
|
||||||
|
@@ -715,10 +715,10 @@ func Test_terminal_write_stdin()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_eof_arg()
|
func Test_terminal_eof_arg()
|
||||||
CheckExecutable python
|
call CheckPython(s:python)
|
||||||
|
|
||||||
call setline(1, ['print("hello")'])
|
call setline(1, ['print("hello")'])
|
||||||
1term ++eof=exit(123) python
|
exe '1term ++eof=exit(123) ' .. s:python
|
||||||
" MS-Windows echoes the input, Unix doesn't.
|
" MS-Windows echoes the input, Unix doesn't.
|
||||||
if has('win32')
|
if has('win32')
|
||||||
call WaitFor({-> getline('$') =~ 'exit(123)'})
|
call WaitFor({-> getline('$') =~ 'exit(123)'})
|
||||||
@@ -733,22 +733,22 @@ endfunc
|
|||||||
|
|
||||||
func Test_terminal_eof_arg_win32_ctrl_z()
|
func Test_terminal_eof_arg_win32_ctrl_z()
|
||||||
CheckMSWindows
|
CheckMSWindows
|
||||||
CheckExecutable python
|
call CheckPython(s:python)
|
||||||
|
|
||||||
call setline(1, ['print("hello")'])
|
call setline(1, ['print("hello")'])
|
||||||
1term ++eof=<C-Z> python
|
exe '1term ++eof=<C-Z> ' .. s:python
|
||||||
call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))})
|
call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))})
|
||||||
call assert_match('\^Z', getline(line('$') - 1))
|
call assert_match('\^Z', getline(line('$') - 1))
|
||||||
%bwipe!
|
%bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_duplicate_eof_arg()
|
func Test_terminal_duplicate_eof_arg()
|
||||||
CheckExecutable python
|
call CheckPython(s:python)
|
||||||
|
|
||||||
" Check the last specified ++eof arg is used and should not memory leak.
|
" Check the last specified ++eof arg is used and should not memory leak.
|
||||||
new
|
new
|
||||||
call setline(1, ['print("hello")'])
|
call setline(1, ['print("hello")'])
|
||||||
1term ++eof=<C-Z> ++eof=exit(123) python
|
exe '1term ++eof=<C-Z> ++eof=exit(123) ' .. s:python
|
||||||
" MS-Windows echoes the input, Unix doesn't.
|
" MS-Windows echoes the input, Unix doesn't.
|
||||||
if has('win32')
|
if has('win32')
|
||||||
call WaitFor({-> getline('$') =~ 'exit(123)'})
|
call WaitFor({-> getline('$') =~ 'exit(123)'})
|
||||||
@@ -1571,9 +1571,8 @@ func Test_terminal_api_call_fail_delete()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_ansicolors_default()
|
func Test_terminal_ansicolors_default()
|
||||||
if !exists('*term_getansicolors')
|
CheckFunction term_getansicolors
|
||||||
throw 'Skipped: term_getansicolors() not supported'
|
|
||||||
endif
|
|
||||||
let colors = [
|
let colors = [
|
||||||
\ '#000000', '#e00000',
|
\ '#000000', '#e00000',
|
||||||
\ '#00e000', '#e0e000',
|
\ '#00e000', '#e0e000',
|
||||||
@@ -1606,9 +1605,8 @@ let s:test_colors = [
|
|||||||
|
|
||||||
func Test_terminal_ansicolors_global()
|
func Test_terminal_ansicolors_global()
|
||||||
CheckFeature termguicolors
|
CheckFeature termguicolors
|
||||||
if !exists('*term_getansicolors')
|
CheckFunction term_getansicolors
|
||||||
throw 'Skipped: term_getansicolors() not supported'
|
|
||||||
endif
|
|
||||||
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
|
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
|
||||||
let buf = Run_shell_in_terminal({})
|
let buf = Run_shell_in_terminal({})
|
||||||
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
|
call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
|
||||||
@@ -1621,9 +1619,8 @@ endfunc
|
|||||||
|
|
||||||
func Test_terminal_ansicolors_func()
|
func Test_terminal_ansicolors_func()
|
||||||
CheckFeature termguicolors
|
CheckFeature termguicolors
|
||||||
if !exists('*term_getansicolors')
|
CheckFunction term_getansicolors
|
||||||
throw 'Skipped: term_getansicolors() not supported'
|
|
||||||
endif
|
|
||||||
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
|
let g:terminal_ansi_colors = reverse(copy(s:test_colors))
|
||||||
let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
|
let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
|
||||||
call assert_equal(s:test_colors, term_getansicolors(buf))
|
call assert_equal(s:test_colors, term_getansicolors(buf))
|
||||||
@@ -2588,6 +2585,7 @@ func Test_hidden_terminal()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_term_nasty_callback()
|
func Test_term_nasty_callback()
|
||||||
|
CheckExecutable sh
|
||||||
func OpenTerms()
|
func OpenTerms()
|
||||||
set hidden
|
set hidden
|
||||||
let g:buf0 = term_start('sh', #{hidden: 1})
|
let g:buf0 = term_start('sh', #{hidden: 1})
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
665,
|
||||||
/**/
|
/**/
|
||||||
664,
|
664,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user