Merge #9092 from janlazo/vim-8.0.1807

This commit is contained in:
Justin M. Keyes 2018-10-08 21:04:46 +02:00 committed by GitHub
commit 05cbe0da30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 2 deletions

View File

@ -189,6 +189,52 @@ func Test_strftime()
call assert_fails('call strftime("%Y", [])', 'E745:')
endfunc
func Test_resolve()
if !has('unix')
return
endif
" Xlink1 -> Xlink2
" Xlink2 -> Xlink3
silent !ln -s -f Xlink2 Xlink1
silent !ln -s -f Xlink3 Xlink2
call assert_equal('Xlink3', resolve('Xlink1'))
call assert_equal('./Xlink3', resolve('./Xlink1'))
call assert_equal('Xlink3/', resolve('Xlink2/'))
" FIXME: these tests result in things like "Xlink2/" instead of "Xlink3/"?!
"call assert_equal('Xlink3/', resolve('Xlink1/'))
"call assert_equal('./Xlink3/', resolve('./Xlink1/'))
"call assert_equal(getcwd() . '/Xlink3/', resolve(getcwd() . '/Xlink1/'))
call assert_equal(getcwd() . '/Xlink3', resolve(getcwd() . '/Xlink1'))
" Test resolve() with a symlink cycle.
" Xlink1 -> Xlink2
" Xlink2 -> Xlink3
" Xlink3 -> Xlink1
silent !ln -s -f Xlink1 Xlink3
call assert_fails('call resolve("Xlink1")', 'E655:')
call assert_fails('call resolve("./Xlink1")', 'E655:')
call assert_fails('call resolve("Xlink2")', 'E655:')
call assert_fails('call resolve("Xlink3")', 'E655:')
call delete('Xlink1')
call delete('Xlink2')
call delete('Xlink3')
silent !ln -s -f Xdir//Xfile Xlink
call assert_equal('Xdir/Xfile', resolve('Xlink'))
call delete('Xlink')
silent !ln -s -f Xlink2/ Xlink1
call assert_equal('Xlink2', resolve('Xlink1'))
call assert_equal('Xlink2/', resolve('Xlink1/'))
call delete('Xlink1')
silent !ln -s -f ./Xlink2 Xlink1
call assert_equal('Xlink2', resolve('Xlink1'))
call assert_equal('./Xlink2', resolve('./Xlink1'))
call delete('Xlink1')
endfunc
func Test_simplify()
call assert_equal('', simplify(''))
call assert_equal('/', simplify('/'))
@ -818,6 +864,19 @@ func Test_filewritable()
bw!
endfunc
func Test_Executable()
if has('win32')
call assert_equal(1, executable('notepad'))
call assert_equal(1, executable('notepad.exe'))
call assert_equal(0, executable('notepad.exe.exe'))
call assert_equal(1, executable('shell32.dll'))
call assert_equal(1, executable('win.ini'))
elseif has('unix')
call assert_equal(1, executable('cat'))
call assert_equal(0, executable('dog'))
endif
endfunc
func Test_hostname()
let hostname_vim = hostname()
if has('unix')

View File

@ -262,7 +262,7 @@ func Test_set_ttytype()
" in travis on some builds. Why? Catch both for now
try
set ttytype=
call assert_report('set ttype= did not fail')
call assert_report('set ttytype= did not fail')
catch /E529\|E522/
endtry
@ -270,7 +270,7 @@ func Test_set_ttytype()
" check for failure of finding the entry and for missing 'cm' entry.
try
set ttytype=xxx
call assert_report('set ttype=xxx did not fail')
call assert_report('set ttytype=xxx did not fail')
catch /E522\|E437/
endtry