From 07fbdf4acc3b15ff97acb5c90243c61d938f8541 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 1 Oct 2018 22:57:49 -0400 Subject: vim-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. (Yasuhiro Matsumoto, closes vim/vim#2855) https://github.com/vim/vim/commit/137374fd6538cf9dee0cb22907728d8fdecb5832 --- src/nvim/testdir/test_unlet.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_unlet.vim b/src/nvim/testdir/test_unlet.vim index 3f06058d03..dbddffb492 100644 --- a/src/nvim/testdir/test_unlet.vim +++ b/src/nvim/testdir/test_unlet.vim @@ -28,3 +28,27 @@ endfunc func Test_unlet_fails() call assert_fails('unlet v:["count"]', 'E46:') endfunc + +func Test_unlet_env() + let envcmd = has('win32') ? 'set' : 'env' + + let $FOOBAR = 'test' + let found = 0 + for kv in split(system(envcmd), "\r*\n") + if kv == 'FOOBAR=test' + let found = 1 + endif + endfor + call assert_equal(1, found) + + unlet $FOOBAR + let found = 0 + for kv in split(system(envcmd), "\r*\n") + if kv == 'FOOBAR=test' + let found = 1 + endif + endfor + call assert_equal(0, found) + + unlet $MUST_NOT_BE_AN_ERROR +endfunc -- cgit From c0d835764fbf33b2effc359498e58e8a114444a8 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 2 Oct 2018 22:10:47 -0400 Subject: vim-patch:8.1.0047: no completion for :unlet $VAR Problem: No completion for :unlet $VAR. Solution: Add completion. (Jason Franklin) https://github.com/vim/vim/commit/19834010889fc5bfa0f88b3ba83133dae6c0a35d --- src/nvim/testdir/test_unlet.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_unlet.vim b/src/nvim/testdir/test_unlet.vim index dbddffb492..b02bdaab3b 100644 --- a/src/nvim/testdir/test_unlet.vim +++ b/src/nvim/testdir/test_unlet.vim @@ -52,3 +52,13 @@ func Test_unlet_env() unlet $MUST_NOT_BE_AN_ERROR endfunc + +func Test_unlet_complete() + let g:FOOBAR = 1 + call feedkeys(":unlet g:FOO\t\n", 'tx') + call assert_true(!exists('g:FOOBAR')) + + let $FOOBAR = 1 + call feedkeys(":unlet $FOO\t\n", 'tx') + call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) +endfunc -- cgit