diff src/testdir/test_vim9_func.vim @ 23689:e7f5931b46ca v8.2.2386

patch 8.2.2386: Vim9: crash when using ":silent! put" Commit: https://github.com/vim/vim/commit/f904133e1a5ea84a124d3ece12b1f0a7392f1ca7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 21 19:41:16 2021 +0100 patch 8.2.2386: Vim9: crash when using ":silent! put" Problem: Vim9: crash when using ":silent! put". Solution: When ignoring an error for ":silent!" rewind the stack and skip ahead to restoring the cmdmod. (closes #7717)
author Bram Moolenaar <Bram@vim.org>
date Thu, 21 Jan 2021 19:45:06 +0100
parents 03acf9c49f07
children 0d56d4f107d8
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2184,6 +2184,24 @@ def Test_dict_member_with_silent()
   CheckScriptSuccess(lines)
 enddef
 
+def Test_skip_cmds_with_silent()
+  var lines =<< trim END
+      vim9script
+
+      def Func(b: bool)
+        Crash()
+      enddef
+
+      def Crash()
+        sil! :/not found/d _
+        sil! :/not found/put _
+      enddef
+
+      Func(true)
+  END
+  CheckScriptSuccess(lines)
+enddef
+
 def Test_opfunc()
   nnoremap <F3> <cmd>set opfunc=Opfunc<cr>g@
   def g:Opfunc(_: any): string