diff src/testdir/test_vim9_script.vim @ 32452:c1f730c2b51e v9.0.1557

patch 9.0.1557: test failures for unreachable code Commit: https://github.com/vim/vim/commit/9d383f30bbd06552ad0bf343b2c03c6a0d1f6df2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 14 21:38:12 2023 +0100 patch 9.0.1557: test failures for unreachable code Problem: Test failures for unreachable code. Solution: Add a test override to ignore unreachable code.
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 May 2023 22:45:04 +0200
parents 2e07c2bb2f60
children db97ccaaa7c8
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -490,7 +490,7 @@ def Test_try_catch_throw()
   try # comment
     add(l, '1')
     throw 'wrong'
-    add(l, '2')
+    add(l, '2')  # "unreachable code"
   catch # comment
     add(l, v:exception)
   finally # comment
@@ -503,7 +503,7 @@ def Test_try_catch_throw()
     try
       add(l, '1')
       throw 'wrong'
-      add(l, '2')
+      add(l, '2')  # "unreachable code"
     catch /right/
       add(l, v:exception)
     endtry
@@ -754,7 +754,7 @@ def Test_try_catch_throw()
     var ret = 5
     try
       throw 'getout'
-      return -1
+      return -1 # "unreachable code"
     catch /getout/
       # ret is evaluated here
       return ret
@@ -1082,7 +1082,12 @@ enddef
 def DeletedFunc(): list<any>
   return ['delete me']
 enddef
-defcompile
+defcompile DeletedFunc
+
+call test_override('unreachable', 1)
+defcompile Test_try_catch_throw
+call test_override('unreachable', 0)
+
 delfunc DeletedFunc
 
 def s:ThrowFromDef()
@@ -1128,7 +1133,7 @@ def Test_try_catch_nested()
   try
     l->add('1')
     throw 'bad'
-    l->add('x')
+    l->add('x')  # "unreachable code"
   catch /bad/
     l->add('2')
     try
@@ -1168,6 +1173,10 @@ def Test_try_catch_nested()
   assert_equal(['1', '2', '3', '4'], l)
 enddef
 
+call test_override('unreachable', 1)
+defcompile Test_try_catch_nested
+call test_override('unreachable', 0)
+
 def s:TryOne(): number
   try
     return 0