patch 8.2.4838: checking for absolute path is not trivial
Problem: Checking for absolute path is not trivial.
Solution: Add isabsolutepath(). (closes #10303)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index a87ca3b..dbed757 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2887,5 +2887,23 @@
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