1
0
forked from aniani/vim

patch 8.2.4838: checking for absolute path is not trivial

Problem:    Checking for absolute path is not trivial.
Solution:   Add isabsolutepath(). (closes #10303)
This commit is contained in:
LemonBoy
2022-04-28 15:26:33 +01:00
committed by Bram Moolenaar
parent 68a573ce2b
commit dca1d40cd0
7 changed files with 55 additions and 0 deletions

View File

@@ -2887,5 +2887,23 @@ func Test_funcref_to_string()
call assert_equal("function('g:Test_funcref_to_string')", string(Fn))
endfunc
" Test for isabsolutepath()
func Test_isabsolutepath()
call assert_false(isabsolutepath(''))
call assert_false(isabsolutepath('.'))
call assert_false(isabsolutepath('../Foo'))
call assert_false(isabsolutepath('Foo/'))
if has('win32')
call assert_true(isabsolutepath('A:\'))
call assert_true(isabsolutepath('A:\Foo'))
call assert_true(isabsolutepath('A:/Foo'))
call assert_false(isabsolutepath('A:Foo'))
call assert_false(isabsolutepath('\Windows'))
call assert_true(isabsolutepath('\\Server2\Share\Test\Foo.txt'))
else
call assert_true(isabsolutepath('/'))
call assert_true(isabsolutepath('/usr/share/'))
endif
endfunc
" vim: shiftwidth=2 sts=2 expandtab