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

Commit: 
https://github.com/vim/vim/commit/2979cfc2627d76a9c09cad46a1647dcd4aa73f5f
Author: Christian Brabandt <c...@256bit.org>
Date:   Wed Jul 24 21:37:39 2024 +0200

    patch 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
    
    fixes: #15334
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index ee7700849..04f82bd50 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -1535,6 +1535,12 @@ def CleanupExpr(passed_expr: string): string
   return expr
 enddef
 
+def Balloon_show(expr: string)
+  if has("+balloon_eval") || has("+balloon_eval_term")
+    balloon_show(expr)
+  endif
+enddef
+
 def HandleEvaluate(msg: string)
   var value = msg
     ->substitute('.*value="\(.*\)"', ' ', '')
@@ -1555,7 +1561,7 @@ def HandleEvaluate(msg: string)
     else
       evalFromBalloonExprResult ..= $' = {value}'
     endif
-    balloon_show(evalFromBalloonExprResult)
+    Balloon_show(evalFromBalloonExprResult)
   else
     echomsg $'"{evalexpr}": {value}'
   endif
diff --git a/src/testdir/test_termdebug.vim b/src/testdir/test_termdebug.vim
index fe5ed89dc..b5c12aefe 100644
--- a/src/testdir/test_termdebug.vim
+++ b/src/testdir/test_termdebug.vim
@@ -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
@@ -164,6 +165,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!
@@ -186,6 +188,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
@@ -246,6 +249,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())
@@ -268,6 +272,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())
@@ -305,6 +310,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)
@@ -368,6 +374,7 @@ function Test_termdebug_save_restore_variables()
   let g:termdebug_config['map_K'] = v:true
 
   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
@@ -398,7 +405,7 @@ function Test_termdebug_sanity_check()
     let s:error_message = "You have a file/folder named '" .. s:filename .. "'"
 
     " Write dummy file with bad name
-    call writefile(['This', 'is', 'a', 'test'], s:filename)
+    call writefile(['This', 'is', 'a', 'test'], s:filename, 'D')
     Termdebug
     call WaitForAssert({-> assert_true(execute('messages') =~ 
s:error_message)})
     call WaitForAssert({-> assert_equal(1, winnr('$'))})
@@ -413,6 +420,7 @@ endfunction
 function Test_termdebug_double_termdebug_instances()
   let s:error_message = 'Terminal debugger already running, cannot run two'
   Termdebug
+  call WaitForAssert({-> assert_true(get(g:, "termdebug_is_running", 
v:false))})
   call WaitForAssert({-> assert_equal(3, winnr('$'))})
   Termdebug
   call WaitForAssert({-> assert_true(execute('messages') =~ s:error_message)})
diff --git a/src/version.c b/src/version.c
index 7cef73c8b..0583e272b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    613,
 /**/
     612,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sWhv5-008Mu7-87%40256bit.org.

Raspunde prin e-mail lui