vim-patch:partial:9.1.0613: tests: termdebug test may fail and leave file around

Problem:  tests: termdebug test may fail and leave temp file around
          (Dominique Pellé)
Solution: only run balloon_show() if the function exists, validate
          termdebug is running using the g: termdebug_is_running var,
          use defer to delete temporary files

Only include:
- guard balloon_show() in the termdebug plugin
- wait for g:termdebug_is_running in Test_termdebug_basic()

The remaining upstream test cleanups do not apply here.

fixes: vim/vim#15334

https://github.com/vim/vim/commit/2979cfc2627d76a9c09cad46a1647dcd4aa73f5f

Co-authored-by: Christian Brabandt <cb@256bit.org>
AI-assisted: Codex
This commit is contained in:
Yinzuo Jiang
2026-03-16 19:05:15 +08:00
committed by zeertzjq
co-authored by Christian Brabandt
parent 6e7fb51813
commit dff515205c
2 changed files with 13 additions and 1 deletions
+6 -1
View File
@@ -69,6 +69,9 @@ set cpo&vim
command -nargs=* -complete=file -bang Termdebug call s:StartDebug(<bang>0, <f-args>)
command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(<bang>0, <f-args>)
" Keep track of whether Termdebug is running for tests and users.
let g:termdebug_is_running = v:false
let s:pc_id = 12
let s:asm_id = 13
let s:break_id = 14 " breakpoint number is added to this
@@ -137,7 +140,7 @@ func s:StartDebugCommand(bang, ...)
endfunc
func s:StartDebug_internal(dict)
if exists('s:gdbwin')
if get(g:, 'termdebug_is_running', v:false) || exists('s:gdbwin')
call s:Echoerr('Terminal debugger already running, cannot run two')
return
endif
@@ -223,6 +226,7 @@ func s:StartDebug_internal(dict)
if exists('#User#TermdebugStartPost')
doauto <nomodeline> User TermdebugStartPost
endif
let g:termdebug_is_running = v:true
endfunc
" Use when debugger didn't start or ended.
@@ -816,6 +820,7 @@ func s:EndDebugCommon()
endif
au! TermDebug
let g:termdebug_is_running = v:false
endfunc
func s:EndPromptDebug(job_id, exit_code, event)