From 090cd109758193de04865d6d8968ece524ae689a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 23 Jan 2018 23:02:43 +0100 Subject: test/old: Fix_truncated_tmpfile(): more flexible --- src/nvim/testdir/shared.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir/shared.vim') diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index d8e2d1d718..4925b04a82 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -9,8 +9,12 @@ func! Fix_truncated_tmpfile(fname) if $TMPDIR ==# '' throw '$TMPDIR is empty' endif - if a:fname !~# $TMPDIR - throw '$TMPDIR not in fname: '.a:fname + let tmpdir_tail = fnamemodify(substitute($TMPDIR, '[\/]\+$', '', 'g'), ':t') + if tmpdir_tail ==# '' + throw 'empty tmpdir_tail' + endif + if a:fname !~# tmpdir_tail + throw printf('$TMPDIR (%s) not in fname: %s', tmpdir_tail, a:fname) endif let last2segments = matchstr(a:fname, '[\/][^\/]\+[\/][^\/]\+$') return $TMPDIR.last2segments -- cgit