diff options
Diffstat (limited to 'src/nvim/testdir/test_environ.vim')
-rw-r--r-- | src/nvim/testdir/test_environ.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_environ.vim b/src/nvim/testdir/test_environ.vim index dd34983ee5..d8344817f5 100644 --- a/src/nvim/testdir/test_environ.vim +++ b/src/nvim/testdir/test_environ.vim @@ -28,6 +28,26 @@ func Test_setenv() call assert_equal(v:null, getenv('TEST ENV')) endfunc +func Test_special_env() + " The value for $HOME is cached internally by Vim, ensure the value is up to + " date. + let orig_ENV = $HOME + + let $HOME = 'foo' + call assert_equal('foo', expand('~')) + " old $HOME value is kept until a new one is set + unlet $HOME + call assert_equal('foo', expand('~')) + + call setenv('HOME', 'bar') + call assert_equal('bar', expand('~')) + " old $HOME value is kept until a new one is set + call setenv('HOME', v:null) + call assert_equal('bar', expand('~')) + + let $HOME = orig_ENV +endfunc + func Test_external_env() call setenv('FOO', 'HelloWorld') if has('win32') |