aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/shared.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-16 02:14:41 +0100
committerGitHub <noreply@github.com>2018-01-16 02:14:41 +0100
commitc06995b34d604a37f80ee1174fcb3530dbd59206 (patch)
treedc1b063644fb484f266e95e12c66bbbfdfa2d38c /src/nvim/testdir/shared.vim
parent26251d6d0681194e7dc57fa2dfb8857576faed21 (diff)
parent9cabe826ba8dfb5dd9464fdf09e28bb25c65ab71 (diff)
downloadrneovim-c06995b34d604a37f80ee1174fcb3530dbd59206.tar.gz
rneovim-c06995b34d604a37f80ee1174fcb3530dbd59206.tar.bz2
rneovim-c06995b34d604a37f80ee1174fcb3530dbd59206.zip
Merge #7858 'vim-patch: spell-related patches'
Diffstat (limited to 'src/nvim/testdir/shared.vim')
-rw-r--r--src/nvim/testdir/shared.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim
index 72cfea96c6..d8e2d1d718 100644
--- a/src/nvim/testdir/shared.vim
+++ b/src/nvim/testdir/shared.vim
@@ -1,5 +1,21 @@
" Functions shared by several tests.
+" {Nvim}
+" Filepath captured from output may be truncated, like this:
+" /home/va...estdir/Xtest-tmpdir/nvimxbXN4i/10
+" Get last 2 segments, then combine with $TMPDIR.
+func! Fix_truncated_tmpfile(fname)
+ " sanity check
+ if $TMPDIR ==# ''
+ throw '$TMPDIR is empty'
+ endif
+ if a:fname !~# $TMPDIR
+ throw '$TMPDIR not in fname: '.a:fname
+ endif
+ let last2segments = matchstr(a:fname, '[\/][^\/]\+[\/][^\/]\+$')
+ return $TMPDIR.last2segments
+endfunc
+
" Get the name of the Python executable.
" Also keeps it in s:python.
func PythonProg()