Mercurial > vim
comparison src/testdir/test_environ.vim @ 28459:52ef65c0637f v8.2.4754
patch 8.2.4754: using cached values after unsetting some environment variables
Commit: https://github.com/vim/vim/commit/7714231bb5b15f7c85453f3945c108478de1d08a
Author: LemonBoy <thatlemon@gmail.com>
Date: Fri Apr 15 20:50:46 2022 +0100
patch 8.2.4754: using cached values after unsetting some environment variables
Problem: Still using cached values after unsetting some known environment
variables.
Solution: Take care of the side effects. (closes #10194)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 15 Apr 2022 22:00:03 +0200 |
parents | 68115baaf9e4 |
children | e3ab1d0f2ef9 |
comparison
equal
deleted
inserted
replaced
28458:9335b10b5eb3 | 28459:52ef65c0637f |
---|---|
24 unlet! $TESTENV | 24 unlet! $TESTENV |
25 eval 'foo'->setenv('TEST ENV') | 25 eval 'foo'->setenv('TEST ENV') |
26 call assert_equal('foo', getenv('TEST ENV')) | 26 call assert_equal('foo', getenv('TEST ENV')) |
27 call setenv('TEST ENV', v:null) | 27 call setenv('TEST ENV', v:null) |
28 call assert_equal(v:null, getenv('TEST ENV')) | 28 call assert_equal(v:null, getenv('TEST ENV')) |
29 endfunc | |
30 | |
31 func Test_special_env() | |
32 " The value for $HOME is cached internally by Vim, ensure the value is up to | |
33 " date. | |
34 let orig_ENV = $HOME | |
35 | |
36 let $HOME = 'foo' | |
37 call assert_equal('foo', expand('~')) | |
38 " old $HOME value is kept until a new one is set | |
39 unlet $HOME | |
40 call assert_equal('foo', expand('~')) | |
41 | |
42 call setenv('HOME', 'bar') | |
43 call assert_equal('bar', expand('~')) | |
44 " old $HOME value is kept until a new one is set | |
45 call setenv('HOME', v:null) | |
46 call assert_equal('bar', expand('~')) | |
47 | |
48 let $HOME = orig_ENV | |
29 endfunc | 49 endfunc |
30 | 50 |
31 func Test_external_env() | 51 func Test_external_env() |
32 call setenv('FOO', 'HelloWorld') | 52 call setenv('FOO', 'HelloWorld') |
33 if has('win32') | 53 if has('win32') |