mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1440: debugger code insufficiently tested
Problem: Debugger code insufficiently tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes #6700)
This commit is contained in:
parent
b96a32ef1a
commit
16c6232cad
@ -337,6 +337,8 @@ func Test_Debugger()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
|
|
||||||
call delete('Xtest.vim')
|
call delete('Xtest.vim')
|
||||||
|
%bw!
|
||||||
|
call assert_fails('breakadd here', 'E32:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_Backtrace_Through_Source()
|
func Test_Backtrace_Through_Source()
|
||||||
@ -1037,7 +1039,6 @@ func Test_breakpt_endif_intr()
|
|||||||
let caught_intr = 0
|
let caught_intr = 0
|
||||||
debuggreedy
|
debuggreedy
|
||||||
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
||||||
call F()
|
|
||||||
catch /^Vim:Interrupt$/
|
catch /^Vim:Interrupt$/
|
||||||
call assert_match('\.F, line 4', v:throwpoint)
|
call assert_match('\.F, line 4', v:throwpoint)
|
||||||
let caught_intr = 1
|
let caught_intr = 1
|
||||||
@ -1068,7 +1069,6 @@ func Test_breakpt_else_intr()
|
|||||||
let caught_intr = 0
|
let caught_intr = 0
|
||||||
debuggreedy
|
debuggreedy
|
||||||
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
||||||
call F()
|
|
||||||
catch /^Vim:Interrupt$/
|
catch /^Vim:Interrupt$/
|
||||||
call assert_match('\.F, line 4', v:throwpoint)
|
call assert_match('\.F, line 4', v:throwpoint)
|
||||||
let caught_intr = 1
|
let caught_intr = 1
|
||||||
@ -1097,7 +1097,6 @@ func Test_breakpt_endwhile_intr()
|
|||||||
let caught_intr = 0
|
let caught_intr = 0
|
||||||
debuggreedy
|
debuggreedy
|
||||||
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
||||||
call F()
|
|
||||||
catch /^Vim:Interrupt$/
|
catch /^Vim:Interrupt$/
|
||||||
call assert_match('\.F, line 4', v:throwpoint)
|
call assert_match('\.F, line 4', v:throwpoint)
|
||||||
let caught_intr = 1
|
let caught_intr = 1
|
||||||
@ -1109,38 +1108,24 @@ func Test_breakpt_endwhile_intr()
|
|||||||
delfunc F
|
delfunc F
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for setting a breakpoint on an :endtry where an exception is pending to
|
" Test for setting a breakpoint on a script local function
|
||||||
" be processed and then quit the script. This should generate an interrupt and
|
func Test_breakpt_scriptlocal_func()
|
||||||
" the thrown exception should be ignored.
|
let g:Xpath = ''
|
||||||
func Test_breakpt_endtry_intr()
|
func s:G()
|
||||||
func F()
|
|
||||||
try
|
|
||||||
let g:Xpath ..= 'a'
|
let g:Xpath ..= 'a'
|
||||||
throw "abc"
|
|
||||||
endtry
|
|
||||||
invalid_command
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
let g:Xpath = ''
|
let funcname = expand("<SID>") .. "G"
|
||||||
breakadd func 4 F
|
exe "breakadd func 1 " .. funcname
|
||||||
try
|
|
||||||
let caught_intr = 0
|
|
||||||
let caught_abc = 0
|
|
||||||
debuggreedy
|
debuggreedy
|
||||||
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
redir => output
|
||||||
call F()
|
call feedkeys(":call " .. funcname .. "()\<CR>c\<CR>", "xt")
|
||||||
catch /abc/
|
redir END
|
||||||
let caught_abc = 1
|
|
||||||
catch /^Vim:Interrupt$/
|
|
||||||
call assert_match('\.F, line 4', v:throwpoint)
|
|
||||||
let caught_intr = 1
|
|
||||||
endtry
|
|
||||||
0debuggreedy
|
0debuggreedy
|
||||||
call assert_equal(1, caught_intr)
|
call assert_match('Breakpoint in "' .. funcname .. '" line 1', output)
|
||||||
call assert_equal(0, caught_abc)
|
|
||||||
call assert_equal('a', g:Xpath)
|
call assert_equal('a', g:Xpath)
|
||||||
breakdel *
|
breakdel *
|
||||||
delfunc F
|
exe "delfunc " .. funcname
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@ -5869,27 +5869,39 @@ func Test_discard_exception_after_error_1()
|
|||||||
call RunInNewVim(test, verify)
|
call RunInNewVim(test, verify)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" TODO: Need to interrupt the code before the endtry is invoked
|
" interrupt the code before the endtry is invoked
|
||||||
func Disable_Test_discard_exception_after_error_2()
|
func Test_discard_exception_after_error_2()
|
||||||
let test =<< trim [CODE]
|
XpathINIT
|
||||||
|
let lines =<< trim [CODE]
|
||||||
try
|
try
|
||||||
Xpath 'a'
|
Xpath 'a'
|
||||||
try
|
try
|
||||||
Xpath 'b'
|
Xpath 'b'
|
||||||
throw "arrgh"
|
throw "arrgh"
|
||||||
call interrupt() " FIXME: throw is not interrupted here
|
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
endtry
|
endtry " interrupt here
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
catch /arrgh/
|
catch /arrgh/
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
let verify =<< trim [CODE]
|
call writefile(lines, 'Xscript')
|
||||||
|
|
||||||
|
breakadd file 7 Xscript
|
||||||
|
try
|
||||||
|
let caught_intr = 0
|
||||||
|
debuggreedy
|
||||||
|
call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
call assert_match('Xscript, line 7', v:throwpoint)
|
||||||
|
let caught_intr = 1
|
||||||
|
endtry
|
||||||
|
0debuggreedy
|
||||||
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('ab', g:Xpath)
|
call assert_equal('ab', g:Xpath)
|
||||||
[CODE]
|
breakdel *
|
||||||
call RunInNewVim(test, verify)
|
call delete('Xscript')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@ -5959,16 +5971,16 @@ func Test_ignore_catch_after_error_2()
|
|||||||
call RunInNewVim(test, verify)
|
call RunInNewVim(test, verify)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" TODO: Need to interrupt the code right before the catch is invoked
|
" interrupt right before a catch is invoked in a script
|
||||||
func FIXME_Test_ignore_catch_after_intr_1()
|
func Test_ignore_catch_after_intr_1()
|
||||||
let test =<< trim [CODE]
|
XpathINIT
|
||||||
|
let lines =<< trim [CODE]
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
Xpath 'a'
|
Xpath 'a'
|
||||||
throw "arrgh"
|
throw "arrgh"
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
catch /.*/ " TODO: Need to interrupt before this catch is
|
catch /.*/ " interrupt here
|
||||||
call interrupt() " invoked
|
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
catch /.*/
|
catch /.*/
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
@ -5979,24 +5991,34 @@ func FIXME_Test_ignore_catch_after_intr_1()
|
|||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
let verify =<< trim [CODE]
|
call writefile(lines, 'Xscript')
|
||||||
|
|
||||||
|
breakadd file 6 Xscript
|
||||||
|
try
|
||||||
|
let caught_intr = 0
|
||||||
|
debuggreedy
|
||||||
|
call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
call assert_match('Xscript, line 6', v:throwpoint)
|
||||||
|
let caught_intr = 1
|
||||||
|
endtry
|
||||||
|
0debuggreedy
|
||||||
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('a', g:Xpath)
|
call assert_equal('a', g:Xpath)
|
||||||
[CODE]
|
breakdel *
|
||||||
call RunInNewVim(test, verify)
|
call delete('Xscript')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" TODO: Need to interrupt the code right before the catch is invoked
|
" interrupt right before a catch is invoked inside a function.
|
||||||
func FIXME_Test_ignore_catch_after_intr_2()
|
func Test_ignore_catch_after_intr_2()
|
||||||
let test =<< trim [CODE]
|
XpathINIT
|
||||||
func I()
|
func F()
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
Xpath 'a'
|
Xpath 'a'
|
||||||
throw "arrgh"
|
throw "arrgh"
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
catch /.*/ " TODO: Need to interrupt before this catch is
|
catch /.*/ " interrupt here
|
||||||
" invoked
|
|
||||||
call interrupt()
|
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
catch /.*/
|
catch /.*/
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
@ -6005,15 +6027,23 @@ func FIXME_Test_ignore_catch_after_intr_2()
|
|||||||
catch /arrgh/
|
catch /arrgh/
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
endtry
|
endtry
|
||||||
|
call assert_report('should not get here')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
call I()
|
breakadd func 6 F
|
||||||
call assert_report('should not get here')
|
try
|
||||||
[CODE]
|
let caught_intr = 0
|
||||||
let verify =<< trim [CODE]
|
debuggreedy
|
||||||
|
call feedkeys(":call F()\<CR>quit\<CR>", "xt")
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
call assert_match('\.F, line 6', v:throwpoint)
|
||||||
|
let caught_intr = 1
|
||||||
|
endtry
|
||||||
|
0debuggreedy
|
||||||
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('a', g:Xpath)
|
call assert_equal('a', g:Xpath)
|
||||||
[CODE]
|
breakdel *
|
||||||
call RunInNewVim(test, verify)
|
delfunc F
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
@ -6050,16 +6080,17 @@ func Test_finally_after_error()
|
|||||||
call RunInNewVim(test, verify)
|
call RunInNewVim(test, verify)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" TODO: Need to interrupt the code right before the finally is invoked
|
" interrupt the code right before the finally is invoked
|
||||||
func FIXME_Test_finally_after_intr()
|
func Test_finally_after_intr()
|
||||||
let test =<< trim [CODE]
|
XpathINIT
|
||||||
|
let lines =<< trim [CODE]
|
||||||
try
|
try
|
||||||
Xpath 'a'
|
Xpath 'a'
|
||||||
try
|
try
|
||||||
Xpath 'b'
|
Xpath 'b'
|
||||||
throw "arrgh"
|
throw "arrgh"
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
finally " TODO: Need to interrupt before the finally is invoked
|
finally " interrupt here
|
||||||
Xpath 'c'
|
Xpath 'c'
|
||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
@ -6068,10 +6099,22 @@ func FIXME_Test_finally_after_intr()
|
|||||||
endtry
|
endtry
|
||||||
call assert_report('should not get here')
|
call assert_report('should not get here')
|
||||||
[CODE]
|
[CODE]
|
||||||
let verify =<< trim [CODE]
|
call writefile(lines, 'Xscript')
|
||||||
|
|
||||||
|
breakadd file 7 Xscript
|
||||||
|
try
|
||||||
|
let caught_intr = 0
|
||||||
|
debuggreedy
|
||||||
|
call feedkeys(":source Xscript\<CR>quit\<CR>", "xt")
|
||||||
|
catch /^Vim:Interrupt$/
|
||||||
|
call assert_match('Xscript, line 7', v:throwpoint)
|
||||||
|
let caught_intr = 1
|
||||||
|
endtry
|
||||||
|
0debuggreedy
|
||||||
|
call assert_equal(1, caught_intr)
|
||||||
call assert_equal('abc', g:Xpath)
|
call assert_equal('abc', g:Xpath)
|
||||||
[CODE]
|
breakdel *
|
||||||
call RunInNewVim(test, verify)
|
call delete('Xscript')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
"-------------------------------------------------------------------------------
|
"-------------------------------------------------------------------------------
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1440,
|
||||||
/**/
|
/**/
|
||||||
1439,
|
1439,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user