comparison src/testdir/test_unlet.vim @ 13923:e4d5726e1678 v8.0.1832

patch 8.0.1832: cannot use :unlet for an environment variable commit https://github.com/vim/vim/commit/137374fd6538cf9dee0cb22907728d8fdecb5832 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 13 15:59:50 2018 +0200 patch 8.0.1832: cannot use :unlet for an environment variable Problem: Cannot use :unlet for an environment variable. Solution: Make it work. Use unsetenv() if available. (Ken Takata, closes #2855)
author Christian Brabandt <cb@256bit.org>
date Sun, 13 May 2018 16:00:07 +0200
parents 8bff367672a4
children a94bc6a7b29e
comparison
equal deleted inserted replaced
13922:1a30d378b70b 13923:e4d5726e1678
19 endfunc 19 endfunc
20 20
21 func Test_unlet_fails() 21 func Test_unlet_fails()
22 call assert_fails('unlet v:["count"]', 'E46:') 22 call assert_fails('unlet v:["count"]', 'E46:')
23 endfunc 23 endfunc
24
25 func Test_unlet_env()
26 let envcmd = has('win32') ? 'set' : 'env'
27
28 let $FOOBAR = 'test'
29 let found = 0
30 for kv in split(system(envcmd), "\r*\n")
31 if kv == 'FOOBAR=test'
32 let found = 1
33 endif
34 endfor
35 call assert_equal(1, found)
36
37 unlet $FOOBAR
38 let found = 0
39 for kv in split(system(envcmd), "\r*\n")
40 if kv == 'FOOBAR=test'
41 let found = 1
42 endif
43 endfor
44 call assert_equal(0, found)
45
46 unlet $MUST_NOT_BE_AN_ERROR
47 endfunc