aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_debugger.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-03 14:22:18 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-12-03 14:47:35 +0800
commit7d283d21390e061d35888b66a15a00898c8af2ff (patch)
treea2fd77936548bdeeaf4291cd7ec0c313bb40376a /src/nvim/testdir/test_debugger.vim
parent8a29d9660ea27ff3cd55555f9373b1528808b264 (diff)
downloadrneovim-7d283d21390e061d35888b66a15a00898c8af2ff.tar.gz
rneovim-7d283d21390e061d35888b66a15a00898c8af2ff.tar.bz2
rneovim-7d283d21390e061d35888b66a15a00898c8af2ff.zip
vim-patch:8.2.1440: debugger code insufficiently tested
Problem: Debugger code insufficiently tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#6700) https://github.com/vim/vim/commit/16c6232cad40af37f37dc9c561392b7761b9e229
Diffstat (limited to 'src/nvim/testdir/test_debugger.vim')
-rw-r--r--src/nvim/testdir/test_debugger.vim43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/nvim/testdir/test_debugger.vim b/src/nvim/testdir/test_debugger.vim
index 2be94409ca..4609b9d2f9 100644
--- a/src/nvim/testdir/test_debugger.vim
+++ b/src/nvim/testdir/test_debugger.vim
@@ -1145,7 +1145,6 @@ func Test_breakpt_endif_intr()
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
@@ -1176,7 +1175,6 @@ func Test_breakpt_else_intr()
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
@@ -1205,7 +1203,6 @@ func Test_breakpt_endwhile_intr()
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
@@ -1217,38 +1214,24 @@ func Test_breakpt_endwhile_intr()
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
+" Test for setting a breakpoint on a script local function
+func Test_breakpt_scriptlocal_func()
+ let g:Xpath = ''
+ func s:G()
+ let g:Xpath ..= 'a'
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
+ let funcname = expand("<SID>") .. "G"
+ exe "breakadd func 1 " .. funcname
+ debuggreedy
+ redir => output
+ call feedkeys(":call " .. funcname .. "()\<CR>c\<CR>", "xt")
+ redir END
0debuggreedy
- call assert_equal(1, caught_intr)
- call assert_equal(0, caught_abc)
+ call assert_match('Breakpoint in "' .. funcname .. '" line 1', output)
call assert_equal('a', g:Xpath)
breakdel *
- delfunc F
+ exe "delfunc " .. funcname
endfunc
" vim: shiftwidth=2 sts=2 expandtab