mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.2230: MS-Windows: testing external commands can be improved
Problem: MS-Windows: testing external commands can be improved. Solution: Adjust tests, remove duplicate test. (closes #4928)
This commit is contained in:
parent
efae76ab1a
commit
077ff436a7
@ -408,8 +408,7 @@ func Test_normal10_expand()
|
|||||||
|
|
||||||
if executable('echo')
|
if executable('echo')
|
||||||
" Test expand(`...`) i.e. backticks command expansion.
|
" Test expand(`...`) i.e. backticks command expansion.
|
||||||
" MS-Windows has a trailing space.
|
call assert_equal('abcde', expand('`echo abcde`'))
|
||||||
call assert_match('^abcde *$', expand('`echo abcde`'))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Test expand(`=...`) i.e. backticks expression expansion
|
" Test expand(`=...`) i.e. backticks expression expansion
|
||||||
|
@ -18,31 +18,10 @@ func Test_System()
|
|||||||
call assert_equal(["as\r", "df\r"], systemlist('more', ["as\<NL>df"]))
|
call assert_equal(["as\r", "df\r"], systemlist('more', ["as\<NL>df"]))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !executable('cat') || !executable('wc')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let out = 'echo 123'->system()
|
|
||||||
" On Windows we may get a trailing space.
|
|
||||||
if out != "123 \n"
|
|
||||||
call assert_equal("123\n", out)
|
|
||||||
endif
|
|
||||||
|
|
||||||
let out = 'echo 123'->systemlist()
|
|
||||||
if !has('win32')
|
|
||||||
call assert_equal(["123"], out)
|
|
||||||
else
|
|
||||||
call assert_equal(["123\r"], out)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if executable('cat')
|
|
||||||
call assert_equal('123', system('cat', '123'))
|
|
||||||
call assert_equal(['123'], systemlist('cat', '123'))
|
|
||||||
call assert_equal(["as\<NL>df"], systemlist('cat', ["as\<NL>df"]))
|
|
||||||
endif
|
|
||||||
|
|
||||||
new Xdummy
|
new Xdummy
|
||||||
call setline(1, ['asdf', "pw\<NL>er", 'xxxx'])
|
call setline(1, ['asdf', "pw\<NL>er", 'xxxx'])
|
||||||
|
|
||||||
|
if executable('wc')
|
||||||
let out = system('wc -l', bufnr('%'))
|
let out = system('wc -l', bufnr('%'))
|
||||||
" On OS/X we get leading spaces
|
" On OS/X we get leading spaces
|
||||||
let out = substitute(out, '^ *', '', '')
|
let out = substitute(out, '^ *', '', '')
|
||||||
@ -57,6 +36,7 @@ func Test_System()
|
|||||||
endif
|
endif
|
||||||
call assert_equal(['3'], out)
|
call assert_equal(['3'], out)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if !has('win32')
|
if !has('win32')
|
||||||
let out = systemlist('cat', bufnr('%'))
|
let out = systemlist('cat', bufnr('%'))
|
||||||
|
@ -563,11 +563,14 @@ func Test_terminal_finish_open_close()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_cwd()
|
func Test_terminal_cwd()
|
||||||
if !executable('pwd')
|
if has('win32')
|
||||||
return
|
let cmd = 'cmd /c cd'
|
||||||
|
else
|
||||||
|
CheckExecutable pwd
|
||||||
|
let cmd = 'pwd'
|
||||||
endif
|
endif
|
||||||
call mkdir('Xdir')
|
call mkdir('Xdir')
|
||||||
let buf = term_start('pwd', {'cwd': 'Xdir'})
|
let buf = term_start(cmd, {'cwd': 'Xdir'})
|
||||||
call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))})
|
call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))})
|
||||||
|
|
||||||
exe buf . 'bwipe'
|
exe buf . 'bwipe'
|
||||||
@ -2031,7 +2034,13 @@ func Test_terminal_does_not_truncate_last_newlines()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_terminal_no_job()
|
func Test_terminal_no_job()
|
||||||
let term = term_start('false', {'term_finish': 'close'})
|
if has('win32')
|
||||||
|
let cmd = 'cmd /c ""'
|
||||||
|
else
|
||||||
|
CheckExecutable false
|
||||||
|
let cmd = 'false'
|
||||||
|
endif
|
||||||
|
let term = term_start(cmd, {'term_finish': 'close'})
|
||||||
call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
|
call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ funct Test_undofile()
|
|||||||
" Test undofile() with 'undodir' set to a non-existing directory.
|
" Test undofile() with 'undodir' set to a non-existing directory.
|
||||||
call assert_equal('', 'Xundofoo'->undofile())
|
call assert_equal('', 'Xundofoo'->undofile())
|
||||||
|
|
||||||
if isdirectory('/tmp')
|
if !has('win32') && isdirectory('/tmp')
|
||||||
set undodir=/tmp
|
set undodir=/tmp
|
||||||
if has('osx')
|
if has('osx')
|
||||||
call assert_equal('/tmp/%private%tmp%file', undofile('///tmp/file'))
|
call assert_equal('/tmp/%private%tmp%file', undofile('///tmp/file'))
|
||||||
|
@ -741,6 +741,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 */
|
||||||
|
/**/
|
||||||
|
2230,
|
||||||
/**/
|
/**/
|
||||||
2229,
|
2229,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user