runtime(syntax-tests): Always delete our copy of "src/testdir/vimcmd"

Commit: 
https://github.com/vim/vim/commit/7a57f597562ccd6fb8762cfeb7ed1326fd69bc89
Author: Aliaksei Budavei <[email protected]>
Date:   Tue May 19 18:30:50 2026 +0000

    runtime(syntax-tests): Always delete our copy of "src/testdir/vimcmd"
    
    Also prune this file whenever:
    - tests cannot be run on this OS;
    - tests fail and no QuitPre event is supported for ":cquit".
    
    related: #19127
    closes:  #20247
    
    Signed-off-by: Aliaksei Budavei <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/syntax/testdir/runtest.vim 
b/runtime/syntax/testdir/runtest.vim
index f71ccf163..b3a6612b7 100644
--- a/runtime/syntax/testdir/runtest.vim
+++ b/runtime/syntax/testdir/runtest.vim
@@ -76,7 +76,14 @@ let s:vimcmdSyntaxFname = fnameescape(syntaxDir .. 
'/testdir/vimcmd')
 if filereadable(s:vimcmdSyntaxFname)
   call delete('vimcmd')
   call filecopy(s:vimcmdSyntaxFname, 'vimcmd')
-  exe 'au ExitPre <buffer> call delete("' .. fnameescape(getcwd() .. 
'/vimcmd') .. '")'
+  " Work around uneventful support for ":cquit".
+  exe printf("%s
%s
%s",
+      \ 'def s:DeleteVimcmdCopy()',
+      \ 'delete("' .. fnameescape(getcwd() .. '/vimcmd') .. '")',
+      \ 'enddef')
+else
+  def s:DeleteVimcmdCopy()
+  enddef
 endif
 
 source util/screendump.vim
@@ -87,6 +94,7 @@ exe 'cd ' .. fnameescape(syntaxDir)
 " MS-Windows the console only has 16 colors and the GUI can't run in a
 " terminal.
 if !CanRunVimInTerminal()
+  call s:DeleteVimcmdCopy()
   call Fatal('Cannot make screendumps, aborting')
 endif
 
@@ -240,6 +248,7 @@ def s:TermWaitAndPollRuler(buf: number, 
in_name_and_out_name: string): list<stri
 enddef
 
 func RunTest()
+  defer s:DeleteVimcmdCopy()
   let XTESTSCRIPT =<< trim END
     " Track the cursor progress through a syntax test file so that any
     " degenerate input can be reported.  Each file will have its own cursor.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wPPfg-00DPxa-Is%40256bit.org.

Raspunde prin e-mail lui