diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-16 08:45:55 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-16 08:45:55 +0100 |
commit | fcd62342d531bdeacbd41a8dfa6163301f1fdf9b (patch) | |
tree | 86f814d4c29b4d6c25a46ff05e1528606270afed /test | |
parent | 6e1a5d4189eee015202cdfe90ced638c195aab23 (diff) | |
download | ale-fcd62342d531bdeacbd41a8dfa6163301f1fdf9b.zip |
Only temporarily replace TMPDIR if it's defined to be an empty string
Diffstat (limited to 'test')
-rw-r--r-- | test/test_tmpdir_wrapper.vader | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/test/test_tmpdir_wrapper.vader b/test/test_tmpdir_wrapper.vader index 4d87061f..151b8943 100644 --- a/test/test_tmpdir_wrapper.vader +++ b/test/test_tmpdir_wrapper.vader @@ -1,13 +1,32 @@ Before: - Save $TMPDIR + let g:exists = exists('$TMPDIR') + let g:old_value = $TMPDIR After: - Restore + 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 -Execute(ale#util#Tempname should create files in /tmp if $TMPDIR isn't set): +Execute(ale#util#Tempname shouldn't replace $TMPDIR and reset them to an empty string.): if has('unix') let $TMPDIR = '' Assert ale#util#Tempname() =~# '^/tmp' - " We should unlet the environment variable again. + + if !has('nvim') + Assert exists('$TMPDIR'), '$TMPDIR doesn''t exist where it should' + endif + AssertEqual '', $TMPDIR endif |