2018-07-12 12:05:59 +00:00
|
|
|
Before:
|
2018-07-16 07:45:55 +00:00
|
|
|
let g:exists = exists('$TMPDIR')
|
|
|
|
let g:old_value = $TMPDIR
|
2018-07-12 12:05:59 +00:00
|
|
|
|
|
|
|
After:
|
2018-07-16 07:45:55 +00:00
|
|
|
if g:exists
|
|
|
|
let $TMPDIR = g:old_value
|
|
|
|
else
|
|
|
|
silent! unlet! $TMPDIR
|
|
|
|
endif
|
|
|
|
|
|
|
|
unlet! g:exists
|
|
|
|
unlet! g:old_value
|
|
|
|
|
|
|
|
Execute(ale#util#Tempname shouldn't set $TMPDIR to an empty string if it isn't set):
|
|
|
|
" You can't run this test twice on old Vim versions.
|
|
|
|
if has('unix')
|
|
|
|
Assert ale#util#Tempname() =~# '^/tmp'
|
|
|
|
Assert !exists('$TMPDIR'), '$TMPDIR exists where it shouldn''t'
|
|
|
|
endif
|
2018-07-12 12:05:59 +00:00
|
|
|
|
2018-07-16 07:45:55 +00:00
|
|
|
Execute(ale#util#Tempname shouldn't replace $TMPDIR and reset them to an empty string.):
|
2018-07-12 12:05:59 +00:00
|
|
|
if has('unix')
|
|
|
|
let $TMPDIR = ''
|
|
|
|
Assert ale#util#Tempname() =~# '^/tmp'
|
2018-07-16 07:45:55 +00:00
|
|
|
|
|
|
|
if !has('nvim')
|
|
|
|
Assert exists('$TMPDIR'), '$TMPDIR doesn''t exist where it should'
|
|
|
|
endif
|
|
|
|
|
2018-07-12 12:05:59 +00:00
|
|
|
AssertEqual '', $TMPDIR
|
|
|
|
endif
|