diff src/testdir/test_terminal3.vim @ 26608:1eb62546e20c v8.2.3833

patch 8.2.3833: error from term_start() not caught by try/catch Commit: https://github.com/vim/vim/commit/c3f91c0648f4b04a6a9ceb4ccec45ea767a63796 Author: ichizok <gclient.gaap@gmail.com> Date: Fri Dec 17 09:44:33 2021 +0000 patch 8.2.3833: error from term_start() not caught by try/catch Problem: Error from term_start() not caught by try/catch. Solution: save and restore did_emsg when applying autocommands. (Ozaki Kiichi, closes #9361)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Dec 2021 10:45:07 +0100
parents c83460a14407
children 8bb07c88ac27
line wrap: on
line diff
--- a/src/testdir/test_terminal3.vim
+++ b/src/testdir/test_terminal3.vim
@@ -901,5 +901,25 @@ func Test_terminal_getwinpos()
   only!
 endfunc
 
+func Test_terminal_term_start_error()
+  func s:term_start_error() abort
+    try
+      return term_start([[]])
+    catch
+      return v:exception
+    finally
+      "
+    endtry
+  endfunc
+  autocmd WinEnter * call type(0)
+
+  " Must not crash in s:term_start_error, nor the exception thrown.
+  let result = s:term_start_error()
+  call assert_match('^Vim(return):E730:', result)
+
+  autocmd! WinEnter
+  delfunc s:term_start_error
+endfunc
+
 
 " vim: shiftwidth=2 sts=2 expandtab