summaryrefslogtreecommitdiffstats
path: root/src/testdir/shared.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/shared.vim')
-rw-r--r--src/testdir/shared.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 3e0929c349..bbd28be1cc 100644
--- 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