comparison src/testdir/test_functions.vim @ 20593:89b0f161e6a6 v8.2.0850

patch 8.2.0850: MS-Windows: exepath() works different from cmd.exe Commit: https://github.com/vim/vim/commit/95da136142628e06425f9d9eb2d1ca56a9e48feb Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 30 18:37:55 2020 +0200 patch 8.2.0850: MS-Windows: exepath() works different from cmd.exe Problem: MS-Windows: exepath() works different from cmd.exe. Solution: Make exepath() work better on MS-Windows. (closes https://github.com/vim/vim/issues/6115)
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 May 2020 18:45:04 +0200
parents 4411c2b96af9
children 7b8ac5e49451
comparison
equal deleted inserted replaced
20592:3b819401b347 20593:89b0f161e6a6
1185 call assert_equal(1, executable('notepad')) 1185 call assert_equal(1, executable('notepad'))
1186 call assert_equal(1, 'notepad.exe'->executable()) 1186 call assert_equal(1, 'notepad.exe'->executable())
1187 call assert_equal(0, executable('notepad.exe.exe')) 1187 call assert_equal(0, executable('notepad.exe.exe'))
1188 call assert_equal(0, executable('shell32.dll')) 1188 call assert_equal(0, executable('shell32.dll'))
1189 call assert_equal(0, executable('win.ini')) 1189 call assert_equal(0, executable('win.ini'))
1190
1191 " get "notepad" path and remove the leading drive and sep. (ex. 'C:\')
1192 let notepadcmd = exepath('notepad.exe')
1193 let driveroot = notepadcmd[:2]
1194 let notepadcmd = notepadcmd[3:]
1195 new
1196 " check that the relative path works in /
1197 execute 'lcd' driveroot
1198 call assert_equal(1, executable(notepadcmd))
1199 call assert_equal(driveroot .. notepadcmd, notepadcmd->exepath())
1200 bwipe
1201
1202 " create "notepad.bat"
1203 call mkdir('Xdir')
1204 let notepadbat = fnamemodify('Xdir/notepad.bat', ':p')
1205 call writefile([], notepadbat)
1206 new
1207 " check that the path and the pathext order is valid
1208 lcd Xdir
1209 let [pathext, $PATHEXT] = [$PATHEXT, '.com;.exe;.bat;.cmd']
1210 call assert_equal(notepadbat, exepath('notepad'))
1211 let $PATHEXT = pathext
1212 bwipe
1213 eval 'Xdir'->delete('rf')
1190 elseif has('unix') 1214 elseif has('unix')
1191 call assert_equal(1, 'cat'->executable()) 1215 call assert_equal(1, 'cat'->executable())
1192 call assert_equal(0, executable('nodogshere')) 1216 call assert_equal(0, executable('nodogshere'))
1193 1217
1194 " get "cat" path and remove the leading / 1218 " get "cat" path and remove the leading /