Patch 8.2.1438
Problem:    Missing tests for interrupting script execution from debugger.
Solution:   Add tests. (Yegappan Lakshmanan, closes #6697)
Files:      src/testdir/test_debugger.vim


*** ../vim-8.2.1437/src/testdir/test_debugger.vim       2020-08-12 
18:50:31.875655822 +0200
--- src/testdir/test_debugger.vim       2020-08-12 22:20:38.649001469 +0200
***************
*** 1020,1023 ****
--- 1020,1146 ----
    call delete('Xtest2.vim')
  endfunc
  
+ " Test for setting a breakpoint on a :endif where the :if condition is false
+ " and then quit the script. This should generate an interrupt.
+ func Test_breakpt_endif_intr()
+   func F()
+     let g:Xpath ..= 'a'
+     if v:false
+       let g:Xpath ..= 'b'
+     endif
+     invalid_command
+   endfunc
+ 
+   let g:Xpath = ''
+   breakadd func 4 F
+   try
+     let caught_intr = 0
+     debuggreedy
+     call feedkeys(":call F()\<CR>quit\<CR>", "xt")
+     call F()
+   catch /^Vim:Interrupt$/
+     call assert_match('\.F, line 4', v:throwpoint)
+     let caught_intr = 1
+   endtry
+   0debuggreedy
+   call assert_equal(1, caught_intr)
+   call assert_equal('a', g:Xpath)
+   breakdel *
+   delfunc F
+ endfunc
+ 
+ " Test for setting a breakpoint on a :else where the :if condition is false
+ " and then quit the script. This should generate an interrupt.
+ func Test_breakpt_else_intr()
+   func F()
+     let g:Xpath ..= 'a'
+     if v:false
+       let g:Xpath ..= 'b'
+     else
+       invalid_command
+     endif
+     invalid_command
+   endfunc
+ 
+   let g:Xpath = ''
+   breakadd func 4 F
+   try
+     let caught_intr = 0
+     debuggreedy
+     call feedkeys(":call F()\<CR>quit\<CR>", "xt")
+     call F()
+   catch /^Vim:Interrupt$/
+     call assert_match('\.F, line 4', v:throwpoint)
+     let caught_intr = 1
+   endtry
+   0debuggreedy
+   call assert_equal(1, caught_intr)
+   call assert_equal('a', g:Xpath)
+   breakdel *
+   delfunc F
+ endfunc
+ 
+ " Test for setting a breakpoint on a :endwhile where the :while condition is
+ " false and then quit the script. This should generate an interrupt.
+ func Test_breakpt_endwhile_intr()
+   func F()
+     let g:Xpath ..= 'a'
+     while v:false
+       let g:Xpath ..= 'b'
+     endwhile
+     invalid_command
+   endfunc
+ 
+   let g:Xpath = ''
+   breakadd func 4 F
+   try
+     let caught_intr = 0
+     debuggreedy
+     call feedkeys(":call F()\<CR>quit\<CR>", "xt")
+     call F()
+   catch /^Vim:Interrupt$/
+     call assert_match('\.F, line 4', v:throwpoint)
+     let caught_intr = 1
+   endtry
+   0debuggreedy
+   call assert_equal(1, caught_intr)
+   call assert_equal('a', g:Xpath)
+   breakdel *
+   delfunc F
+ endfunc
+ 
+ " Test for setting a breakpoint on an :endtry where an exception is pending to
+ " be processed and then quit the script. This should generate an interrupt and
+ " the thrown exception should be ignored.
+ func Test_breakpt_endtry_intr()
+   func F()
+     try
+       let g:Xpath ..= 'a'
+       throw "abc"
+     endtry
+     invalid_command
+   endfunc
+ 
+   let g:Xpath = ''
+   breakadd func 4 F
+   try
+     let caught_intr = 0
+     let caught_abc = 0
+     debuggreedy
+     call feedkeys(":call F()\<CR>quit\<CR>", "xt")
+     call F()
+   catch /abc/
+     let caught_abc = 1
+   catch /^Vim:Interrupt$/
+     call assert_match('\.F, line 4', v:throwpoint)
+     let caught_intr = 1
+   endtry
+   0debuggreedy
+   call assert_equal(1, caught_intr)
+   call assert_equal(0, caught_abc)
+   call assert_equal('a', g:Xpath)
+   breakdel *
+   delfunc F
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1437/src/version.c       2020-08-12 22:18:19.121805947 +0200
--- src/version.c       2020-08-12 22:21:40.124658589 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1438,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
188. You purchase a laptop so you can surf while sitting on the can.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 on the web visit 
https://groups.google.com/d/msgid/vim_dev/202008122022.07CKMgca154957%40masaka.moolenaar.net.

Raspunde prin e-mail lui