Mercurial > vim
comparison src/testdir/test_vimscript.vim @ 21781:99fe9e960207 v8.2.1440
patch 8.2.1440: debugger code insufficiently tested
Commit: https://github.com/vim/vim/commit/16c6232cad40af37f37dc9c561392b7761b9e229
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 13 19:20:04 2020 +0200
patch 8.2.1440: debugger code insufficiently tested
Problem: Debugger code insufficiently tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6700)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Aug 2020 19:30:04 +0200 |
parents | baccf9e06efe |
children | 51d591dbb8df |
comparison
equal
deleted
inserted
replaced
21780:3efab8d47de0 | 21781:99fe9e960207 |
---|---|
5867 call assert_equal('ab', g:Xpath) | 5867 call assert_equal('ab', g:Xpath) |
5868 [CODE] | 5868 [CODE] |
5869 call RunInNewVim(test, verify) | 5869 call RunInNewVim(test, verify) |
5870 endfunc | 5870 endfunc |
5871 | 5871 |
5872 " TODO: Need to interrupt the code before the endtry is invoked | 5872 " interrupt the code before the endtry is invoked |
5873 func Disable_Test_discard_exception_after_error_2() | 5873 func Test_discard_exception_after_error_2() |
5874 let test =<< trim [CODE] | 5874 XpathINIT |
5875 let lines =<< trim [CODE] | |
5875 try | 5876 try |
5876 Xpath 'a' | 5877 Xpath 'a' |
5877 try | 5878 try |
5878 Xpath 'b' | 5879 Xpath 'b' |
5879 throw "arrgh" | 5880 throw "arrgh" |
5880 call interrupt() " FIXME: throw is not interrupted here | 5881 call assert_report('should not get here') |
5881 call assert_report('should not get here') | 5882 endtry " interrupt here |
5882 endtry | |
5883 call assert_report('should not get here') | 5883 call assert_report('should not get here') |
5884 catch /arrgh/ | 5884 catch /arrgh/ |
5885 call assert_report('should not get here') | 5885 call assert_report('should not get here') |
5886 endtry | 5886 endtry |
5887 call assert_report('should not get here') | 5887 call assert_report('should not get here') |
5888 [CODE] | 5888 [CODE] |
5889 let verify =<< trim [CODE] | 5889 call writefile(lines, 'Xscript') |
5890 call assert_equal('ab', g:Xpath) | 5890 |
5891 [CODE] | 5891 breakadd file 7 Xscript |
5892 call RunInNewVim(test, verify) | 5892 try |
5893 let caught_intr = 0 | |
5894 debuggreedy | |
5895 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt") | |
5896 catch /^Vim:Interrupt$/ | |
5897 call assert_match('Xscript, line 7', v:throwpoint) | |
5898 let caught_intr = 1 | |
5899 endtry | |
5900 0debuggreedy | |
5901 call assert_equal(1, caught_intr) | |
5902 call assert_equal('ab', g:Xpath) | |
5903 breakdel * | |
5904 call delete('Xscript') | |
5893 endfunc | 5905 endfunc |
5894 | 5906 |
5895 "------------------------------------------------------------------------------- | 5907 "------------------------------------------------------------------------------- |
5896 " Test 82: Ignoring :catch clauses after an error or interrupt {{{1 | 5908 " Test 82: Ignoring :catch clauses after an error or interrupt {{{1 |
5897 " | 5909 " |
5957 call assert_equal('a', g:Xpath) | 5969 call assert_equal('a', g:Xpath) |
5958 [CODE] | 5970 [CODE] |
5959 call RunInNewVim(test, verify) | 5971 call RunInNewVim(test, verify) |
5960 endfunc | 5972 endfunc |
5961 | 5973 |
5962 " TODO: Need to interrupt the code right before the catch is invoked | 5974 " interrupt right before a catch is invoked in a script |
5963 func FIXME_Test_ignore_catch_after_intr_1() | 5975 func Test_ignore_catch_after_intr_1() |
5964 let test =<< trim [CODE] | 5976 XpathINIT |
5977 let lines =<< trim [CODE] | |
5965 try | 5978 try |
5966 try | 5979 try |
5967 Xpath 'a' | 5980 Xpath 'a' |
5968 throw "arrgh" | 5981 throw "arrgh" |
5969 call assert_report('should not get here') | 5982 call assert_report('should not get here') |
5970 catch /.*/ " TODO: Need to interrupt before this catch is | 5983 catch /.*/ " interrupt here |
5971 call interrupt() " invoked | |
5972 call assert_report('should not get here') | 5984 call assert_report('should not get here') |
5973 catch /.*/ | 5985 catch /.*/ |
5974 call assert_report('should not get here') | 5986 call assert_report('should not get here') |
5975 endtry | 5987 endtry |
5976 call assert_report('should not get here') | 5988 call assert_report('should not get here') |
5977 catch /arrgh/ | 5989 catch /arrgh/ |
5978 call assert_report('should not get here') | 5990 call assert_report('should not get here') |
5979 endtry | 5991 endtry |
5980 call assert_report('should not get here') | 5992 call assert_report('should not get here') |
5981 [CODE] | 5993 [CODE] |
5982 let verify =<< trim [CODE] | 5994 call writefile(lines, 'Xscript') |
5983 call assert_equal('a', g:Xpath) | 5995 |
5984 [CODE] | 5996 breakadd file 6 Xscript |
5985 call RunInNewVim(test, verify) | 5997 try |
5986 endfunc | 5998 let caught_intr = 0 |
5987 | 5999 debuggreedy |
5988 " TODO: Need to interrupt the code right before the catch is invoked | 6000 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt") |
5989 func FIXME_Test_ignore_catch_after_intr_2() | 6001 catch /^Vim:Interrupt$/ |
5990 let test =<< trim [CODE] | 6002 call assert_match('Xscript, line 6', v:throwpoint) |
5991 func I() | 6003 let caught_intr = 1 |
5992 try | 6004 endtry |
5993 try | 6005 0debuggreedy |
5994 Xpath 'a' | 6006 call assert_equal(1, caught_intr) |
5995 throw "arrgh" | 6007 call assert_equal('a', g:Xpath) |
5996 call assert_report('should not get here') | 6008 breakdel * |
5997 catch /.*/ " TODO: Need to interrupt before this catch is | 6009 call delete('Xscript') |
5998 " invoked | 6010 endfunc |
5999 call interrupt() | 6011 |
6000 call assert_report('should not get here') | 6012 " interrupt right before a catch is invoked inside a function. |
6001 catch /.*/ | 6013 func Test_ignore_catch_after_intr_2() |
6002 call assert_report('should not get here') | 6014 XpathINIT |
6003 endtry | 6015 func F() |
6004 call assert_report('should not get here') | 6016 try |
6005 catch /arrgh/ | 6017 try |
6006 call assert_report('should not get here') | 6018 Xpath 'a' |
6007 endtry | 6019 throw "arrgh" |
6008 endfunc | 6020 call assert_report('should not get here') |
6009 | 6021 catch /.*/ " interrupt here |
6010 call I() | 6022 call assert_report('should not get here') |
6023 catch /.*/ | |
6024 call assert_report('should not get here') | |
6025 endtry | |
6026 call assert_report('should not get here') | |
6027 catch /arrgh/ | |
6028 call assert_report('should not get here') | |
6029 endtry | |
6011 call assert_report('should not get here') | 6030 call assert_report('should not get here') |
6012 [CODE] | 6031 endfunc |
6013 let verify =<< trim [CODE] | 6032 |
6014 call assert_equal('a', g:Xpath) | 6033 breakadd func 6 F |
6015 [CODE] | 6034 try |
6016 call RunInNewVim(test, verify) | 6035 let caught_intr = 0 |
6036 debuggreedy | |
6037 call feedkeys(":call F()\<CR>quit\<CR>", "xt") | |
6038 catch /^Vim:Interrupt$/ | |
6039 call assert_match('\.F, line 6', v:throwpoint) | |
6040 let caught_intr = 1 | |
6041 endtry | |
6042 0debuggreedy | |
6043 call assert_equal(1, caught_intr) | |
6044 call assert_equal('a', g:Xpath) | |
6045 breakdel * | |
6046 delfunc F | |
6017 endfunc | 6047 endfunc |
6018 | 6048 |
6019 "------------------------------------------------------------------------------- | 6049 "------------------------------------------------------------------------------- |
6020 " Test 83: Executing :finally clauses after an error or interrupt {{{1 | 6050 " Test 83: Executing :finally clauses after an error or interrupt {{{1 |
6021 " | 6051 " |
6048 call assert_equal('abc', g:Xpath) | 6078 call assert_equal('abc', g:Xpath) |
6049 [CODE] | 6079 [CODE] |
6050 call RunInNewVim(test, verify) | 6080 call RunInNewVim(test, verify) |
6051 endfunc | 6081 endfunc |
6052 | 6082 |
6053 " TODO: Need to interrupt the code right before the finally is invoked | 6083 " interrupt the code right before the finally is invoked |
6054 func FIXME_Test_finally_after_intr() | 6084 func Test_finally_after_intr() |
6055 let test =<< trim [CODE] | 6085 XpathINIT |
6086 let lines =<< trim [CODE] | |
6056 try | 6087 try |
6057 Xpath 'a' | 6088 Xpath 'a' |
6058 try | 6089 try |
6059 Xpath 'b' | 6090 Xpath 'b' |
6060 throw "arrgh" | 6091 throw "arrgh" |
6061 call assert_report('should not get here') | 6092 call assert_report('should not get here') |
6062 finally " TODO: Need to interrupt before the finally is invoked | 6093 finally " interrupt here |
6063 Xpath 'c' | 6094 Xpath 'c' |
6064 endtry | 6095 endtry |
6065 call assert_report('should not get here') | 6096 call assert_report('should not get here') |
6066 catch /arrgh/ | 6097 catch /arrgh/ |
6067 call assert_report('should not get here') | 6098 call assert_report('should not get here') |
6068 endtry | 6099 endtry |
6069 call assert_report('should not get here') | 6100 call assert_report('should not get here') |
6070 [CODE] | 6101 [CODE] |
6071 let verify =<< trim [CODE] | 6102 call writefile(lines, 'Xscript') |
6072 call assert_equal('abc', g:Xpath) | 6103 |
6073 [CODE] | 6104 breakadd file 7 Xscript |
6074 call RunInNewVim(test, verify) | 6105 try |
6106 let caught_intr = 0 | |
6107 debuggreedy | |
6108 call feedkeys(":source Xscript\<CR>quit\<CR>", "xt") | |
6109 catch /^Vim:Interrupt$/ | |
6110 call assert_match('Xscript, line 7', v:throwpoint) | |
6111 let caught_intr = 1 | |
6112 endtry | |
6113 0debuggreedy | |
6114 call assert_equal(1, caught_intr) | |
6115 call assert_equal('abc', g:Xpath) | |
6116 breakdel * | |
6117 call delete('Xscript') | |
6075 endfunc | 6118 endfunc |
6076 | 6119 |
6077 "------------------------------------------------------------------------------- | 6120 "------------------------------------------------------------------------------- |
6078 " Test 84: Exceptions in autocommand sequences. {{{1 | 6121 " Test 84: Exceptions in autocommand sequences. {{{1 |
6079 " | 6122 " |