summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e8c372cd2..fb0b19365 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1273,7 +1273,16 @@ endfunc
func Test_executable_longname()
CheckMSWindows
- let fname = 'X' . repeat('あ', 200) . '.bat'
+ " Create a temporary .bat file with 205 characters in the name.
+ " Maximum length of a filename (including the path) on MS-Windows is 259
+ " characters.
+ " See https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
+ let len = 259 - getcwd()->len() - 6
+ if len > 200
+ let len = 200
+ endif
+
+ let fname = 'X' . repeat('あ', len) . '.bat'
call writefile([], fname)
call assert_equal(1, executable(fname))
call delete(fname)