diff src/testdir/test_functions.vim @ 28629:5ef46b938c6e v8.2.4838

patch 8.2.4838: checking for absolute path is not trivial Commit: https://github.com/vim/vim/commit/dca1d40cd0f2af0755519e7028378bd3c8fefd31 Author: LemonBoy <thatlemon@gmail.com> Date: Thu Apr 28 15:26:33 2022 +0100 patch 8.2.4838: checking for absolute path is not trivial Problem: Checking for absolute path is not trivial. Solution: Add isabsolutepath(). (closes https://github.com/vim/vim/issues/10303)
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Apr 2022 16:30:03 +0200
parents 0390c4848b27
children 53c608c7ea9e
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -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