mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test/old: Fix_truncated_tmpfile(): more flexible
This commit is contained in:
parent
15119f943a
commit
090cd10975
@ -9,8 +9,12 @@ func! Fix_truncated_tmpfile(fname)
|
|||||||
if $TMPDIR ==# ''
|
if $TMPDIR ==# ''
|
||||||
throw '$TMPDIR is empty'
|
throw '$TMPDIR is empty'
|
||||||
endif
|
endif
|
||||||
if a:fname !~# $TMPDIR
|
let tmpdir_tail = fnamemodify(substitute($TMPDIR, '[\/]\+$', '', 'g'), ':t')
|
||||||
throw '$TMPDIR not in fname: '.a:fname
|
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
|
endif
|
||||||
let last2segments = matchstr(a:fname, '[\/][^\/]\+[\/][^\/]\+$')
|
let last2segments = matchstr(a:fname, '[\/][^\/]\+[\/][^\/]\+$')
|
||||||
return $TMPDIR.last2segments
|
return $TMPDIR.last2segments
|
||||||
|
@ -1075,7 +1075,6 @@ func! Test_normal19_z_spell()
|
|||||||
if !has("spell") || !has('syntax')
|
if !has("spell") || !has('syntax')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
" let $TMPDIR=fnamemodify($TMPDIR, ':.')
|
|
||||||
new
|
new
|
||||||
call append(0, ['1 good', '2 goood', '3 goood'])
|
call append(0, ['1 good', '2 goood', '3 goood'])
|
||||||
set spell spellfile=./Xspellfile.add spelllang=en
|
set spell spellfile=./Xspellfile.add spelllang=en
|
||||||
@ -1122,7 +1121,6 @@ func! Test_normal19_z_spell()
|
|||||||
" Test for zG
|
" Test for zG
|
||||||
let a=execute('unsilent norm! V$zG')
|
let a=execute('unsilent norm! V$zG')
|
||||||
call assert_match("Word '2 goood' added to .*", a)
|
call assert_match("Word '2 goood' added to .*", a)
|
||||||
set shortmess=
|
|
||||||
let fname=matchstr(a, 'to\s\+\zs\f\+$')
|
let fname=matchstr(a, 'to\s\+\zs\f\+$')
|
||||||
let fname=Fix_truncated_tmpfile(fname)
|
let fname=Fix_truncated_tmpfile(fname)
|
||||||
let cnt=readfile(fname)
|
let cnt=readfile(fname)
|
||||||
|
Loading…
Reference in New Issue
Block a user