mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 21:02:11 +00:00
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
2979cfc262
Co-authored-by: Christian Brabandt <cb@256bit.org>
AI-assisted: Codex
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -63,6 +63,7 @@ func Test_termdebug_basic()
|
||||
|
||||
edit XTD_basic.c
|
||||
Termdebug ./XTD_basic
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
let gdb_buf = winbufnr(1)
|
||||
wincmd b
|
||||
@@ -196,6 +197,7 @@ func Test_termdebug_basic()
|
||||
let g:termdebug_config = {}
|
||||
let g:termdebug_config['use_prompt'] = use_prompt
|
||||
TermdebugCommand ./XTD_basic arg args
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
wincmd t
|
||||
quit!
|
||||
@@ -218,6 +220,7 @@ func Test_termdebug_tbreak()
|
||||
execute 'edit ' .. src_name
|
||||
execute 'Termdebug ./' .. bin_name
|
||||
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
let gdb_buf = winbufnr(1)
|
||||
wincmd b
|
||||
@@ -279,6 +282,7 @@ func Test_termdebug_mapping()
|
||||
call assert_true(maparg('-', 'n', 0, 1)->empty())
|
||||
call assert_true(maparg('+', 'n', 0, 1)->empty())
|
||||
Termdebug
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
wincmd b
|
||||
call assert_false(maparg('K', 'n', 0, 1)->empty())
|
||||
@@ -301,6 +305,7 @@ func Test_termdebug_mapping()
|
||||
nnoremap - :echom "-"<cr>
|
||||
nnoremap + :echom "+"<cr>
|
||||
Termdebug
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
wincmd b
|
||||
call assert_false(maparg('K', 'n', 0, 1)->empty())
|
||||
@@ -338,6 +343,7 @@ func Test_termdebug_mapping()
|
||||
" Start termdebug from foo
|
||||
buffer foo
|
||||
Termdebug
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
wincmd b
|
||||
call assert_true(maparg('K', 'n', 0, 1).buffer)
|
||||
@@ -440,6 +446,7 @@ function Test_termdebug_save_restore_variables()
|
||||
let g:termdebug_config['map_K'] = 1
|
||||
|
||||
Termdebug
|
||||
call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", v:false))})
|
||||
call WaitForAssert({-> assert_equal(3, winnr('$'))})
|
||||
call WaitForAssert({-> assert_match(&mousemodel, 'popup_setpos')})
|
||||
wincmd t
|
||||
|
||||
Reference in New Issue
Block a user