diff src/testdir/shared.vim @ 21190:10eb6c38938c v8.2.1146

patch 8.2.1146: not enough testing for Python Commit: https://github.com/vim/vim/commit/ab5894638413748fcedfe28691e6c27893924520 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jul 6 21:03:06 2020 +0200 patch 8.2.1146: not enough testing for Python Problem: Not enough testing for Python. Solution: Add more tests. Fix uncovered problems. (Yegappan Lakshmanan, closes #6392)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Jul 2020 21:15:05 +0200
parents cae01dabd78e
children d265b908c802
line wrap: on
line diff
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -353,4 +353,19 @@ func GetMessages()
   return msg_list
 endfunc
 
+" Run the list of commands in 'cmds' and look for 'errstr' in exception.
+" Note that assert_fails() cannot be used in some places and this function
+" can be used.
+func AssertException(cmds, errstr)
+  let save_exception = ''
+  try
+    for cmd in a:cmds
+      exe cmd
+    endfor
+  catch
+    let save_exception = v:exception
+  endtry
+  call assert_match(a:errstr, save_exception)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab