comparison src/testdir/test_terminal.vim @ 20219:820f24dc1e3e v8.2.0665

patch 8.2.0665: wrongly assuming Python executable is called "python" Commit: https://github.com/vim/vim/commit/a161cb5dddd6d374899e46fde834ce9ba5c80c0b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 30 19:09:35 2020 +0200 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 https://github.com/vim/vim/issues/6016) Also use CheckFunction if possible.
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Apr 2020 19:15:05 +0200
parents 2fb397573541
children a85a3207679f
comparison
equal deleted inserted replaced
20218:036aa462aa0d 20219:820f24dc1e3e
713 call assert_equal(['2', '2', '10'], nrs) 713 call assert_equal(['2', '2', '10'], nrs)
714 %bwipe! 714 %bwipe!
715 endfunc 715 endfunc
716 716
717 func Test_terminal_eof_arg() 717 func Test_terminal_eof_arg()
718 CheckExecutable python 718 call CheckPython(s:python)
719 719
720 call setline(1, ['print("hello")']) 720 call setline(1, ['print("hello")'])
721 1term ++eof=exit(123) python 721 exe '1term ++eof=exit(123) ' .. s:python
722 " MS-Windows echoes the input, Unix doesn't. 722 " MS-Windows echoes the input, Unix doesn't.
723 if has('win32') 723 if has('win32')
724 call WaitFor({-> getline('$') =~ 'exit(123)'}) 724 call WaitFor({-> getline('$') =~ 'exit(123)'})
725 call assert_equal('hello', getline(line('$') - 1)) 725 call assert_equal('hello', getline(line('$') - 1))
726 else 726 else
731 %bwipe! 731 %bwipe!
732 endfunc 732 endfunc
733 733
734 func Test_terminal_eof_arg_win32_ctrl_z() 734 func Test_terminal_eof_arg_win32_ctrl_z()
735 CheckMSWindows 735 CheckMSWindows
736 CheckExecutable python 736 call CheckPython(s:python)
737 737
738 call setline(1, ['print("hello")']) 738 call setline(1, ['print("hello")'])
739 1term ++eof=<C-Z> python 739 exe '1term ++eof=<C-Z> ' .. s:python
740 call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))}) 740 call WaitForAssert({-> assert_match('\^Z', getline(line('$') - 1))})
741 call assert_match('\^Z', getline(line('$') - 1)) 741 call assert_match('\^Z', getline(line('$') - 1))
742 %bwipe! 742 %bwipe!
743 endfunc 743 endfunc
744 744
745 func Test_terminal_duplicate_eof_arg() 745 func Test_terminal_duplicate_eof_arg()
746 CheckExecutable python 746 call CheckPython(s:python)
747 747
748 " Check the last specified ++eof arg is used and should not memory leak. 748 " Check the last specified ++eof arg is used and should not memory leak.
749 new 749 new
750 call setline(1, ['print("hello")']) 750 call setline(1, ['print("hello")'])
751 1term ++eof=<C-Z> ++eof=exit(123) python 751 exe '1term ++eof=<C-Z> ++eof=exit(123) ' .. s:python
752 " MS-Windows echoes the input, Unix doesn't. 752 " MS-Windows echoes the input, Unix doesn't.
753 if has('win32') 753 if has('win32')
754 call WaitFor({-> getline('$') =~ 'exit(123)'}) 754 call WaitFor({-> getline('$') =~ 'exit(123)'})
755 call assert_equal('hello', getline(line('$') - 1)) 755 call assert_equal('hello', getline(line('$') - 1))
756 else 756 else
1569 call delete('Xscript') 1569 call delete('Xscript')
1570 call ch_logfile('', '') 1570 call ch_logfile('', '')
1571 endfunc 1571 endfunc
1572 1572
1573 func Test_terminal_ansicolors_default() 1573 func Test_terminal_ansicolors_default()
1574 if !exists('*term_getansicolors') 1574 CheckFunction term_getansicolors
1575 throw 'Skipped: term_getansicolors() not supported' 1575
1576 endif
1577 let colors = [ 1576 let colors = [
1578 \ '#000000', '#e00000', 1577 \ '#000000', '#e00000',
1579 \ '#00e000', '#e0e000', 1578 \ '#00e000', '#e0e000',
1580 \ '#0000e0', '#e000e0', 1579 \ '#0000e0', '#e000e0',
1581 \ '#00e0e0', '#e0e0e0', 1580 \ '#00e0e0', '#e0e0e0',
1604 \ '#610d0a', '#6e6479', 1603 \ '#610d0a', '#6e6479',
1605 \] 1604 \]
1606 1605
1607 func Test_terminal_ansicolors_global() 1606 func Test_terminal_ansicolors_global()
1608 CheckFeature termguicolors 1607 CheckFeature termguicolors
1609 if !exists('*term_getansicolors') 1608 CheckFunction term_getansicolors
1610 throw 'Skipped: term_getansicolors() not supported' 1609
1611 endif
1612 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) 1610 let g:terminal_ansi_colors = reverse(copy(s:test_colors))
1613 let buf = Run_shell_in_terminal({}) 1611 let buf = Run_shell_in_terminal({})
1614 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) 1612 call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf))
1615 call StopShellInTerminal(buf) 1613 call StopShellInTerminal(buf)
1616 call TermWait(buf) 1614 call TermWait(buf)
1619 unlet g:terminal_ansi_colors 1617 unlet g:terminal_ansi_colors
1620 endfunc 1618 endfunc
1621 1619
1622 func Test_terminal_ansicolors_func() 1620 func Test_terminal_ansicolors_func()
1623 CheckFeature termguicolors 1621 CheckFeature termguicolors
1624 if !exists('*term_getansicolors') 1622 CheckFunction term_getansicolors
1625 throw 'Skipped: term_getansicolors() not supported' 1623
1626 endif
1627 let g:terminal_ansi_colors = reverse(copy(s:test_colors)) 1624 let g:terminal_ansi_colors = reverse(copy(s:test_colors))
1628 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors}) 1625 let buf = Run_shell_in_terminal({'ansi_colors': s:test_colors})
1629 call assert_equal(s:test_colors, term_getansicolors(buf)) 1626 call assert_equal(s:test_colors, term_getansicolors(buf))
1630 1627
1631 call term_setansicolors(buf, g:terminal_ansi_colors) 1628 call term_setansicolors(buf, g:terminal_ansi_colors)
2586 call assert_equal('', bufname('^$')) 2583 call assert_equal('', bufname('^$'))
2587 call StopShellInTerminal(buf) 2584 call StopShellInTerminal(buf)
2588 endfunc 2585 endfunc
2589 2586
2590 func Test_term_nasty_callback() 2587 func Test_term_nasty_callback()
2588 CheckExecutable sh
2591 func OpenTerms() 2589 func OpenTerms()
2592 set hidden 2590 set hidden
2593 let g:buf0 = term_start('sh', #{hidden: 1}) 2591 let g:buf0 = term_start('sh', #{hidden: 1})
2594 call popup_create(g:buf0, {}) 2592 call popup_create(g:buf0, {})
2595 let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'}) 2593 let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'})