diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2023-01-14 23:10:03 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2023-01-14 23:10:03 -0700 |
| commit | 396c48d54ef313ca02e2e97849e51721094400cd (patch) | |
| tree | 87857ac4a5a7f88e2ebc519e73df061f9ed2f8e1 /src/nvim/testdir/shared.vim | |
| parent | 968aa6e3ed0497ea99f123c74c5fd0f3880ccc63 (diff) | |
| parent | 6134c1e8a39a5e61d0593613343a5923a86e3545 (diff) | |
| download | rneovim-396c48d54ef313ca02e2e97849e51721094400cd.tar.gz rneovim-396c48d54ef313ca02e2e97849e51721094400cd.tar.bz2 rneovim-396c48d54ef313ca02e2e97849e51721094400cd.zip | |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'src/nvim/testdir/shared.vim')
| -rw-r--r-- | src/nvim/testdir/shared.vim | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index c2809844ac..33f6d9a2d0 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -9,7 +9,7 @@ source view_util.vim " {Nvim} " Filepath captured from output may be truncated, like this: -" /home/va...estdir/Xtest-tmpdir/nvimxbXN4i/10 +" /home/va...estdir/X-test-tmpdir/nvimxbXN4i/10 " Get last 2 segments, then combine with $TMPDIR. func! Fix_truncated_tmpfile(fname) " sanity check @@ -285,6 +285,12 @@ func GetVimCommand(...) return cmd endfunc +" Return one when it looks like the tests are run with valgrind, which means +" that everything is much slower. +func RunningWithValgrind() + return GetVimCommand() =~ '\<valgrind\>' +endfunc + " Get the command to run Vim, with --clean instead of "-u NONE". func GetVimCommandClean() let cmd = GetVimCommand() @@ -317,7 +323,6 @@ func RunVim(before, after, arguments) endfunc func RunVimPiped(before, after, arguments, pipecmd) - let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' let cmd = GetVimCommand() let args = '' if len(a:before) > 0 @@ -332,7 +337,9 @@ func RunVimPiped(before, after, arguments, pipecmd) " Optionally run Vim under valgrind " let cmd = 'valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind ' . cmd - exe "silent !" . a:pipecmd . cmd . args . ' ' . a:arguments + let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' + " Nvim does not support -Z flag, remove it. + exe "silent !" . a:pipecmd . cmd . args . ' ' . substitute(a:arguments, '-Z', '', 'g') if len(a:before) > 0 call delete('Xbefore.vim') @@ -364,4 +371,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 |