]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(syntax-tests): Adapt "runtime/syntax/testdir/vimcmd" for "src/testdir/util...
authorAliaksei Budavei <0x000c70@gmail.com>
Fri, 9 Jan 2026 17:19:18 +0000 (17:19 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 9 Jan 2026 17:19:18 +0000 (17:19 +0000)
Problem:  When "util/shared.vim" is sourced and GetVimCommand is called on
          behalf of the syntax test runner, the "vimcmd" file will be searched
          in the current working directory, i.e. "src/testdir", whereas the
          desired file is in "runtime/syntax/testdir".
Solution: Temporarily copy "vimcmd" between test directories.

closes: #19127

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/testdir/runtest.vim

index 6dce6508a601e54dc8be570217274694f9f5345b..9392a4667177a787b8225db8ae805755742fdec1 100644 (file)
@@ -69,6 +69,16 @@ endif
 " Use the script for source code screendump testing.  It sources other scripts,
 " therefore we must "cd" there.
 cd ../../src/testdir
+
+let s:vimcmdSyntaxFname = fnameescape(syntaxDir .. '/testdir/vimcmd')
+
+" Adapt "runtime/syntax/testdir/vimcmd" for "src/testdir/util/shared.vim".
+if filereadable(s:vimcmdSyntaxFname)
+  call delete('vimcmd')
+  call filecopy(s:vimcmdSyntaxFname, 'vimcmd')
+  exe 'au ExitPre <buffer> call delete("' .. fnameescape(getcwd() .. '/vimcmd') .. '")'
+endif
+
 source util/screendump.vim
 source util/term_util.vim
 exe 'cd ' .. fnameescape(syntaxDir)