Merge #8160 'win: oldtests: prefer cmd.exe'

This commit is contained in:
Justin M. Keyes
2018-04-15 02:37:22 +02:00
committed by GitHub
14 changed files with 44 additions and 31 deletions

View File

@@ -100,7 +100,7 @@ bin\nvim --version ; exitIfFailed
$failed = $false $failed = $false
# Temporarily turn off tracing to reduce log file output # Temporarily turn off tracing to reduce log file output
Set-PSDebug -Off Set-PSDebug -Off
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs | cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
foreach { $failed = $failed -or foreach { $failed = $failed -or
$_ -match 'Running functional tests failed with error'; $_ } $_ -match 'Running functional tests failed with error'; $_ }
Set-PSDebug -Trace 1 Set-PSDebug -Trace 1
@@ -114,7 +114,7 @@ if ($uploadToCodecov) {
} }
# Old tests # Old tests
$env:PATH += ';C:\msys64\usr\bin' $env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 & "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1
if ($uploadToCodecov) { if ($uploadToCodecov) {

View File

@@ -4208,8 +4208,7 @@ getftype({fname}) *getftype()*
getftype("/home") getftype("/home")
< Note that a type such as "link" will only be returned on < Note that a type such as "link" will only be returned on
systems that support it. On some systems only "dir" and systems that support it. On some systems only "dir" and
"file" are returned. On MS-Windows a symbolic link to a "file" are returned.
directory returns "dir" instead of "link".
*getline()* *getline()*
getline({lnum} [, {end}]) getline({lnum} [, {end}])

View File

@@ -20,13 +20,13 @@ SCRIPTS_DEFAULT = \
test40.out \ test40.out \
test42.out \ test42.out \
test48.out \ test48.out \
test49.out \
test52.out \ test52.out \
test64.out \ test64.out \
ifneq ($(OS),Windows_NT) ifneq ($(OS),Windows_NT)
SCRIPTS_DEFAULTS := $(SCRIPTS_DEFAULT) \ SCRIPTS_DEFAULTS := $(SCRIPTS_DEFAULT) \
test17.out \ test17.out \
test49.out \
endif endif

View File

@@ -61,7 +61,7 @@ set nomore
lang mess C lang mess C
" Always use forward slashes. " Always use forward slashes.
set shellslash " set shellslash
" Prepare for calling test_garbagecollect_now(). " Prepare for calling test_garbagecollect_now().
let v:testing = 1 let v:testing = 1

View File

@@ -17,3 +17,11 @@ let &packpath = &rtp
" Make sure $HOME does not get read or written. " Make sure $HOME does not get read or written.
let $HOME = '/does/not/exist' let $HOME = '/does/not/exist'
" Use default shell on Windows to avoid segfault, caused by TUI
if has('win32')
let $SHELL = ''
let $TERM = ''
let &shell = empty($COMSPEC) ? exepath('cmd.exe') : $COMSPEC
set shellcmdflag=/s/c shellxquote=\" shellredir=>%s\ 2>&1
endif

View File

@@ -154,7 +154,7 @@ func Test_getcompletion()
call assert_equal([], l) call assert_equal([], l)
let l = getcompletion('', 'dir') let l = getcompletion('', 'dir')
call assert_true(index(l, 'sautest/') >= 0) call assert_true(index(l, expand('sautest/')) >= 0)
let l = getcompletion('NoMatch', 'dir') let l = getcompletion('NoMatch', 'dir')
call assert_equal([], l) call assert_equal([], l)
@@ -246,7 +246,7 @@ func Test_getcompletion()
" Command line completion tests " Command line completion tests
let l = getcompletion('cd ', 'cmdline') let l = getcompletion('cd ', 'cmdline')
call assert_true(index(l, 'sautest/') >= 0) call assert_true(index(l, expand('sautest/')) >= 0)
let l = getcompletion('cd NoMatch', 'cmdline') let l = getcompletion('cd NoMatch', 'cmdline')
call assert_equal([], l) call assert_equal([], l)
let l = getcompletion('let v:n', 'cmdline') let l = getcompletion('let v:n', 'cmdline')
@@ -288,7 +288,7 @@ func Test_expand_star_star()
call mkdir('a/b', 'p') call mkdir('a/b', 'p')
call writefile(['asdfasdf'], 'a/b/fileXname') call writefile(['asdfasdf'], 'a/b/fileXname')
call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt') call feedkeys(":find **/fileXname\<Tab>\<CR>", 'xt')
call assert_equal('find a/b/fileXname', getreg(':')) call assert_equal('find '.expand('a/b/fileXname'), getreg(':'))
bwipe! bwipe!
call delete('a', 'rf') call delete('a', 'rf')
endfunc endfunc

View File

@@ -3,6 +3,8 @@
" Do all the tests in a separate window to avoid E211 when we recursively " Do all the tests in a separate window to avoid E211 when we recursively
" delete the Xfind directory during cleanup " delete the Xfind directory during cleanup
func Test_find_complete() func Test_find_complete()
let shellslash = &shellslash
set shellslash
set belloff=all set belloff=all
" On windows a stale "Xfind" directory may exist, remove it so that " On windows a stale "Xfind" directory may exist, remove it so that
@@ -154,4 +156,5 @@ func Test_find_complete()
exe 'cd ' . cwd exe 'cd ' . cwd
call delete('Xfind', 'rf') call delete('Xfind', 'rf')
set path& set path&
let &shellslash = shellslash
endfunc endfunc

View File

@@ -30,7 +30,7 @@ func Test_help_tagjump()
help sp?it help sp?it
call assert_equal("help", &filetype) call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*:split\*') call assert_true(getline('.') =~ '\*'.(has('win32') ? 'split()' : ':split').'\*')
helpclose helpclose
help :? help :?

View File

@@ -13,12 +13,19 @@ endif
let s:script = 'test_makeencoding.py' let s:script = 'test_makeencoding.py'
let s:message_tbl = { if has('iconv')
let s:message_tbl = {
\ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好', \ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好',
\ 'latin1': 'ÀÈÌÒÙ', \ 'latin1': 'ÀÈÌÒÙ',
\ 'cp932': 'こんにちは', \ 'cp932': 'こんにちは',
\ 'cp936': '你好', \ 'cp936': '你好',
\} \}
else
let s:message_tbl = {
\ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好',
\ 'latin1': 'ÀÈÌÒÙ',
\}
endif
" Tests for :cgetfile and :lgetfile. " Tests for :cgetfile and :lgetfile.

View File

@@ -158,6 +158,8 @@ func Test_set_completion()
call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:) call assert_equal('"set fileencodings:ucs-bom,utf-8,default,latin1', @:)
" Expand directories. " Expand directories.
let shellslash = &shellslash
set shellslash
call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":set cdpath=./\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_match('./samples/ ', @:) call assert_match('./samples/ ', @:)
call assert_notmatch('./small.vim ', @:) call assert_notmatch('./small.vim ', @:)
@@ -168,6 +170,7 @@ func Test_set_completion()
call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:) call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
let &shellslash = shellslash
endfunc endfunc
func Test_set_errors() func Test_set_errors()

View File

@@ -850,17 +850,17 @@ func s:dir_stack_tests(cchar)
let qf = g:Xgetlist() let qf = g:Xgetlist()
call assert_equal('dir1/a/habits2.txt', bufname(qf[1].bufnr)) call assert_equal(expand('dir1/a/habits2.txt'), bufname(qf[1].bufnr))
call assert_equal(1, qf[1].lnum) call assert_equal(1, qf[1].lnum)
call assert_equal('dir1/a/b/habits3.txt', bufname(qf[3].bufnr)) call assert_equal(expand('dir1/a/b/habits3.txt'), bufname(qf[3].bufnr))
call assert_equal(2, qf[3].lnum) call assert_equal(2, qf[3].lnum)
call assert_equal('dir1/a/habits2.txt', bufname(qf[4].bufnr)) call assert_equal(expand('dir1/a/habits2.txt'), bufname(qf[4].bufnr))
call assert_equal(7, qf[4].lnum) call assert_equal(7, qf[4].lnum)
call assert_equal('dir1/c/habits4.txt', bufname(qf[6].bufnr)) call assert_equal(expand('dir1/c/habits4.txt'), bufname(qf[6].bufnr))
call assert_equal(3, qf[6].lnum) call assert_equal(3, qf[6].lnum)
call assert_equal('habits1.txt', bufname(qf[9].bufnr)) call assert_equal('habits1.txt', bufname(qf[9].bufnr))
call assert_equal(4, qf[9].lnum) call assert_equal(4, qf[9].lnum)
call assert_equal('dir2/habits5.txt', bufname(qf[11].bufnr)) call assert_equal(expand('dir2/habits5.txt'), bufname(qf[11].bufnr))
call assert_equal(5, qf[11].lnum) call assert_equal(5, qf[11].lnum)
let &efm=save_efm let &efm=save_efm
@@ -1065,7 +1065,7 @@ func Test_efm2()
call assert_equal(8, len(l)) call assert_equal(8, len(l))
call assert_equal(89, l[4].lnum) call assert_equal(89, l[4].lnum)
call assert_equal(1, l[4].valid) call assert_equal(1, l[4].valid)
call assert_equal('unittests/dbfacadeTest.py', bufname(l[4].bufnr)) call assert_equal(expand('unittests/dbfacadeTest.py'), bufname(l[4].bufnr))
" The following sequence of commands used to crash Vim " The following sequence of commands used to crash Vim
set efm=%W%m set efm=%W%m
@@ -1609,11 +1609,11 @@ func Test_two_windows()
laddexpr 'one.txt:3:one one one' laddexpr 'one.txt:3:one one one'
let loc_one = getloclist(one_id) let loc_one = getloclist(one_id)
call assert_equal('Xone/a/one.txt', bufname(loc_one[1].bufnr)) call assert_equal(expand('Xone/a/one.txt'), bufname(loc_one[1].bufnr))
call assert_equal(3, loc_one[1].lnum) call assert_equal(3, loc_one[1].lnum)
let loc_two = getloclist(two_id) let loc_two = getloclist(two_id)
call assert_equal('Xtwo/a/two.txt', bufname(loc_two[1].bufnr)) call assert_equal(expand('Xtwo/a/two.txt'), bufname(loc_two[1].bufnr))
call assert_equal(5, loc_two[1].lnum) call assert_equal(5, loc_two[1].lnum)
call win_gotoid(one_id) call win_gotoid(one_id)

View File

@@ -6,11 +6,6 @@ func Test_recover_root_dir()
set dir=/ set dir=/
call assert_fails('recover', 'E305:') call assert_fails('recover', 'E305:')
close! close!
if has('win32') || filewritable('/') == 2
" can write in / directory on MS-Windows
set dir=/notexist/
endif
call assert_fails('split Xtest', 'E303:') call assert_fails('split Xtest', 'E303:')
set dir& set dir&
endfunc endfunc

View File

@@ -86,7 +86,7 @@ func Test_win32_symlink_dir()
let res = system('dir C:\Users /a') let res = system('dir C:\Users /a')
if match(res, '\C<SYMLINKD> *All Users') >= 0 if match(res, '\C<SYMLINKD> *All Users') >= 0
" Get the filetype of the symlink. " Get the filetype of the symlink.
call assert_equal('dir', getftype('C:\Users\All Users')) call assert_equal('link', getftype('C:\Users\All Users'))
endif endif
endif endif
endfunc endfunc

View File

@@ -5,14 +5,12 @@ function! Test_System()
return return
endif endif
let out = system('echo 123') let out = system('echo 123')
" On Windows we may get a trailing space. call assert_equal("123\n", out)
if out != "123 \n"
call assert_equal("123\n", out)
endif
let out = systemlist('echo 123') let out = systemlist('echo 123')
" On Windows we may get a trailing space and CR. if &shell =~# 'cmd.exe$'
if out != ["123 \r"] call assert_equal(["123\r"], out)
else
call assert_equal(['123'], out) call assert_equal(['123'], out)
endif endif