aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-01-23 23:02:43 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-01-23 23:06:22 +0100
commit090cd109758193de04865d6d8968ece524ae689a (patch)
treee33b3fbefb6e0b5ce8edaacada56a56d6eb672fc /src
parent15119f943ab8c2d089f45969da06b6b58b4d0036 (diff)
downloadrneovim-090cd109758193de04865d6d8968ece524ae689a.tar.gz
rneovim-090cd109758193de04865d6d8968ece524ae689a.tar.bz2
rneovim-090cd109758193de04865d6d8968ece524ae689a.zip
test/old: Fix_truncated_tmpfile(): more flexible
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/shared.vim8
-rw-r--r--src/nvim/testdir/test_normal.vim2
2 files changed, 6 insertions, 4 deletions
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
diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim
index c28d76e66f..307f62e17a 100644
--- a/src/nvim/testdir/test_normal.vim
+++ b/src/nvim/testdir/test_normal.vim
@@ -1075,7 +1075,6 @@ func! Test_normal19_z_spell()
if !has("spell") || !has('syntax')
return
endif
- " let $TMPDIR=fnamemodify($TMPDIR, ':.')
new
call append(0, ['1 good', '2 goood', '3 goood'])
set spell spellfile=./Xspellfile.add spelllang=en
@@ -1122,7 +1121,6 @@ func! Test_normal19_z_spell()
" Test for zG
let a=execute('unsilent norm! V$zG')
call assert_match("Word '2 goood' added to .*", a)
- set shortmess=
let fname=matchstr(a, 'to\s\+\zs\f\+$')
let fname=Fix_truncated_tmpfile(fname)
let cnt=readfile(fname)