diff src/testdir/test_vim9_disassemble.vim @ 27541:8af6e7761b0c v8.2.4297

patch 8.2.4297: Vim9: not all code covered by tests Commit: https://github.com/vim/vim/commit/21ebb0899ecf9049c3e1c9cbc2e06fd8e2a99e06 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 4 21:58:58 2022 +0000 patch 8.2.4297: Vim9: not all code covered by tests Problem: Vim9: not all code covered by tests. Solution: Add a couple more tests.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Feb 2022 23:00:05 +0100
parents a14c4d3e3260
children 5c4ab8d4472c
line wrap: on
line diff
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -2487,6 +2487,44 @@ def Test_debug_for()
         res)
 enddef
 
+def s:TryCatch()
+  try
+    echo "try"
+  catch /error/
+    echo "caught"
+  endtry
+enddef
+
+def Test_debug_try_catch()
+  var res = execute('disass debug s:TryCatch')
+  assert_match('<SNR>\d*_TryCatch\_s*' ..
+          'try\_s*' ..
+          '0 DEBUG line 1-1 varcount 0\_s*' ..
+          '1 TRY catch -> 7, endtry -> 17\_s*' ..
+          'echo "try"\_s*' ..
+          '2 DEBUG line 2-2 varcount 0\_s*' ..
+          '3 PUSHS "try"\_s*' ..
+          '4 ECHO 1\_s*' ..
+          'catch /error/\_s*' ..
+          '5 DEBUG line 3-3 varcount 0\_s*' ..
+          '6 JUMP -> 17\_s*' ..
+          '7 DEBUG line 4-3 varcount 0\_s*' ..
+          '8 PUSH v:exception\_s*' ..
+          '9 PUSHS "error"\_s*' ..
+          '10 COMPARESTRING =\~\_s*' ..
+          '11 JUMP_IF_FALSE -> 17\_s*' ..
+          '12 CATCH\_s*' ..
+          'echo "caught"\_s*' ..
+          '13 DEBUG line 4-4 varcount 0\_s*' ..
+          '14 PUSHS "caught"\_s*' ..
+          '15 ECHO 1\_s*' ..
+          'endtry\_s*' ..
+          '16 DEBUG line 5-5 varcount 0\_s*' ..
+          '17 ENDTRY\_s*' ..
+          '\d\+ RETURN void',
+        res)
+enddef
+
 func s:Legacy() dict
   echo 'legacy'
 endfunc