@@ -5869,27 +5869,39 @@ func Test_discard_exception_after_error_1()
58695869 call RunInNewVim (test, verify)
58705870endfunc
58715871
5872- " TODO: Need to interrupt the code before the endtry is invoked
5873- func Disable_Test_discard_exception_after_error_2 ()
5874- let test = << trim [CODE]
5872+ " interrupt the code before the endtry is invoked
5873+ func Test_discard_exception_after_error_2 ()
5874+ XpathINIT
5875+ let lines = << trim [CODE]
58755876 try
58765877 Xpath ' a'
58775878 try
58785879 Xpath ' b'
58795880 throw " arrgh"
5880- call interrupt () " FIXME: throw is not interrupted here
58815881 call assert_report (' should not get here' )
5882- endtry
5882+ endtry " interrupt here
58835883 call assert_report (' should not get here' )
58845884 catch /arrgh/
58855885 call assert_report (' should not get here' )
58865886 endtry
58875887 call assert_report (' should not get here' )
58885888 [CODE]
5889- let verify = << trim [CODE]
5890- call assert_equal (' ab' , g: Xpath )
5891- [CODE]
5892- call RunInNewVim (test, verify)
5889+ call writefile (lines , ' Xscript' )
5890+
5891+ breakadd file 7 Xscript
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+ 0 debuggreedy
5901+ call assert_equal (1 , caught_intr)
5902+ call assert_equal (' ab' , g: Xpath )
5903+ breakdel *
5904+ call delete (' Xscript' )
58935905endfunc
58945906
58955907" -------------------------------------------------------------------------------
@@ -5959,16 +5971,16 @@ func Test_ignore_catch_after_error_2()
59595971 call RunInNewVim (test, verify)
59605972endfunc
59615973
5962- " TODO: Need to interrupt the code right before the catch is invoked
5963- func FIXME_Test_ignore_catch_after_intr_1 ()
5964- let test = << trim [CODE]
5974+ " interrupt right before a catch is invoked in a script
5975+ func Test_ignore_catch_after_intr_1 ()
5976+ XpathINIT
5977+ let lines = << trim [CODE]
59655978 try
59665979 try
59675980 Xpath ' a'
59685981 throw " arrgh"
59695982 call assert_report (' should not get here' )
5970- catch /.*/ " TODO: Need to interrupt before this catch is
5971- call interrupt () " invoked
5983+ catch /.*/ " interrupt here
59725984 call assert_report (' should not get here' )
59735985 catch /.*/
59745986 call assert_report (' should not get here' )
@@ -5979,41 +5991,59 @@ func FIXME_Test_ignore_catch_after_intr_1()
59795991 endtry
59805992 call assert_report (' should not get here' )
59815993 [CODE]
5982- let verify = << trim [CODE]
5983- call assert_equal (' a' , g: Xpath )
5984- [CODE]
5985- call RunInNewVim (test, verify)
5994+ call writefile (lines , ' Xscript' )
5995+
5996+ breakadd file 6 Xscript
5997+ try
5998+ let caught_intr = 0
5999+ debuggreedy
6000+ call feedkeys (" :source Xscript\<CR> quit\<CR> " , " xt" )
6001+ catch /^Vim:Interrupt$/
6002+ call assert_match (' Xscript, line 6' , v: throwpoint )
6003+ let caught_intr = 1
6004+ endtry
6005+ 0 debuggreedy
6006+ call assert_equal (1 , caught_intr)
6007+ call assert_equal (' a' , g: Xpath )
6008+ breakdel *
6009+ call delete (' Xscript' )
59866010endfunc
59876011
5988- " TODO: Need to interrupt the code right before the catch is invoked
5989- func FIXME_Test_ignore_catch_after_intr_2 ()
5990- let test = << trim [CODE]
5991- func I ()
6012+ " interrupt right before a catch is invoked inside a function.
6013+ func Test_ignore_catch_after_intr_2 ()
6014+ XpathINIT
6015+ func F ()
6016+ try
59926017 try
5993- try
5994- Xpath ' a'
5995- throw " arrgh"
5996- call assert_report (' should not get here' )
5997- catch /.*/ " TODO: Need to interrupt before this catch is
5998- " invoked
5999- call interrupt ()
6000- call assert_report (' should not get here' )
6001- catch /.*/
6002- call assert_report (' should not get here' )
6003- endtry
6018+ Xpath ' a'
6019+ throw " arrgh"
60046020 call assert_report (' should not get here' )
6005- catch /arrgh/
6021+ catch /.*/ " interrupt here
6022+ call assert_report (' should not get here' )
6023+ catch /.*/
60066024 call assert_report (' should not get here' )
60076025 endtry
6008- endfunc
6009-
6010- call I ()
6026+ call assert_report (' should not get here' )
6027+ catch /arrgh/
6028+ call assert_report (' should not get here' )
6029+ endtry
60116030 call assert_report (' should not get here' )
6012- [CODE]
6013- let verify = << trim [CODE]
6014- call assert_equal (' a' , g: Xpath )
6015- [CODE]
6016- call RunInNewVim (test, verify)
6031+ endfunc
6032+
6033+ breakadd func 6 F
6034+ try
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+ 0 debuggreedy
6043+ call assert_equal (1 , caught_intr)
6044+ call assert_equal (' a' , g: Xpath )
6045+ breakdel *
6046+ delfunc F
60176047endfunc
60186048
60196049" -------------------------------------------------------------------------------
@@ -6050,16 +6080,17 @@ func Test_finally_after_error()
60506080 call RunInNewVim (test, verify)
60516081endfunc
60526082
6053- " TODO: Need to interrupt the code right before the finally is invoked
6054- func FIXME_Test_finally_after_intr ()
6055- let test = << trim [CODE]
6083+ " interrupt the code right before the finally is invoked
6084+ func Test_finally_after_intr ()
6085+ XpathINIT
6086+ let lines = << trim [CODE]
60566087 try
60576088 Xpath ' a'
60586089 try
60596090 Xpath ' b'
60606091 throw " arrgh"
60616092 call assert_report (' should not get here' )
6062- finally " TODO: Need to interrupt before the finally is invoked
6093+ finally " interrupt here
60636094 Xpath ' c'
60646095 endtry
60656096 call assert_report (' should not get here' )
@@ -6068,10 +6099,22 @@ func FIXME_Test_finally_after_intr()
60686099 endtry
60696100 call assert_report (' should not get here' )
60706101 [CODE]
6071- let verify = << trim [CODE]
6072- call assert_equal (' abc' , g: Xpath )
6073- [CODE]
6074- call RunInNewVim (test, verify)
6102+ call writefile (lines , ' Xscript' )
6103+
6104+ breakadd file 7 Xscript
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+ 0 debuggreedy
6114+ call assert_equal (1 , caught_intr)
6115+ call assert_equal (' abc' , g: Xpath )
6116+ breakdel *
6117+ call delete (' Xscript' )
60756118endfunc
60766119
60776120" -------------------------------------------------------------------------------
0 commit comments