Mercurial > vim
diff src/testdir/test_terminal.vim @ 12389:d0cf7f71b95b v8.0.1074
patch 8.0.1074: ":term NONE" does not work on MS-Windows
commit https://github.com/vim/vim/commit/2dc9d26c14e410c09e538cccfa90da19ae344ba4
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 8 14:39:30 2017 +0200
patch 8.0.1074: ":term NONE" does not work on MS-Windows
Problem: ":term NONE" does not work on MS-Windows.
Solution: Make it work. Split "pty" into "pty_in" and "pty_out". (Yasuhiro
Matsumoto, closes #2058, closes #2045)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 08 Sep 2017 14:45:05 +0200 |
parents | 9a7fb1d01137 |
children | 6ef5e636f246 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -36,11 +36,11 @@ endfunc func Test_terminal_basic() let buf = Run_shell_in_terminal({}) if has("unix") - call assert_match("^/dev/", job_info(g:job).tty) - call assert_match("^/dev/", term_gettty('')) + call assert_match('^/dev/', job_info(g:job).tty_out) + call assert_match('^/dev/', term_gettty('')) else - call assert_match("^winpty://", job_info(g:job).tty) - call assert_match("^winpty://", term_gettty('')) + call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out) + call assert_match('^\\\\.\\pipe\\', term_gettty('')) endif call assert_equal('t', mode()) call assert_match('%aR[^\n]*running]', execute('ls')) @@ -539,10 +539,6 @@ func Test_terminal_write_stdin() endfunc func Test_terminal_no_cmd() - " Todo: make this work on all systems. - if !has('unix') - return - endif " Todo: make this work in the GUI if !has('gui_running') return @@ -550,11 +546,20 @@ func Test_terminal_no_cmd() let buf = term_start('NONE', {}) call assert_notequal(0, buf) - let pty = job_info(term_getjob(buf))['tty'] + let pty = job_info(term_getjob(buf))['tty_out'] call assert_notequal('', pty) - call system('echo "look here" > ' . pty) + if has('win32') + silent exe '!cmd /c "echo look here > ' . pty . '"' + else + call system('echo "look here" > ' . pty) + endif call term_wait(buf) - call assert_equal('look here', term_getline(buf, 1)) + + let result = term_getline(buf, 1) + if has('win32') + let result = substitute(result, '\s\+$', '', '') + endif + call assert_equal('look here', result) bwipe! endfunc @@ -600,6 +605,7 @@ func Test_terminal_redir_file() call WaitFor('len(readfile("Xfile")) > 0') call assert_match('123', readfile('Xfile')[0]) call delete('Xfile') + bwipe endif if has('unix') @@ -608,6 +614,7 @@ func Test_terminal_redir_file() call WaitFor('len(readfile("Xfile")) > 0') call assert_match('executing job failed', readfile('Xfile')[0]) call delete('Xfile') + bwipe call writefile(['one line'], 'Xfile') let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'})