]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4297: Vim9: not all code covered by tests v8.2.4297
authorBram Moolenaar <Bram@vim.org>
Fri, 4 Feb 2022 21:58:58 +0000 (21:58 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 4 Feb 2022 21:58:58 +0000 (21:58 +0000)
Problem:    Vim9: not all code covered by tests.
Solution:   Add a couple more tests.

src/testdir/test_vim9_disassemble.vim
src/testdir/test_vim9_script.vim
src/version.c

index 41aaa2845de50c95dad1a5e7967dfc6b5ea9dd4b..1e61853e086772617b366ee3edcc4c5bec6f25ce 100644 (file)
@@ -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
index 767abd4855cc5c533628ab50d2a0ec3b4b87f54f..28dd78b0e60815d1cccc49db7e78e411d1e492b6 100644 (file)
@@ -1580,6 +1580,14 @@ def Test_if_const_expr()
     burp
   endif
 
+  if 0
+    if 1
+      echo nothing
+    elseif 1
+      echo still nothing
+    endif
+  endif
+
   # expression with line breaks skipped
   if false
       ('aaa'
index 503f873df03673b76f4a74eff11fd67a055025e8..95f2b5fd39336d20f44e0962a10a45f9742b9c3a 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4297,
 /**/
     4296,
 /**/