]> granicus.if.org Git - vim/commitdiff
patch 8.2.3480: test does not fail without the fix for a crash v8.2.3480
authorDominique Pelle <dominique.pelle@gmail.com>
Tue, 5 Oct 2021 18:28:01 +0000 (19:28 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 5 Oct 2021 18:28:01 +0000 (19:28 +0100)
Problem:    Test does not fail without the fix for a crash.
Solution:   Write the bad code in a file and source it. (Dominique PellĂ©,
            closes #8961)

src/testdir/test_trycatch.vim
src/version.c

index ac12671da6a860e5ce3613883cdd269282694a3f..4b8f7efbd18a9a935bed280f2fadc1755427ce45 100644 (file)
@@ -2274,17 +2274,26 @@ func Test_user_command_function_call_with_endtry()
 endfunc
 
 func ThisWillFail()
-  try
-    if x | endif
-  catch
-    for l in []
-  finally 
+
 endfunc
 
+" This was crashing prior to the fix in 8.2.3478.
 func Test_error_in_catch_and_finally()
-  call assert_fails('call ThisWillFail()', ['E121:', 'E600:'])
-endfunc
+  let lines =<< trim END
+    try
+      echo x
+    catch
+      for l in []
+    finally
+  END
+  call writefile(lines, 'XtestCatchAndFinally')
+  try
+    source XtestCatchAndFinally
+  catch /E600:/
+  endtry
 
+  call delete('XtestCatchAndFinally')
+endfunc
 
 " Modeline                                                                 {{{1
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index 96e760605681a2da59e81c30d7af4791601f2e4b..70f363a421bde8b7d253476305ae963dbeaf2f47 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3480,
 /**/
     3479,
 /**/