aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/environ_spec.lua
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-07-30 11:37:39 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-09 23:42:03 +0200
commit06d9cc734bf0397b365d5d75b1766a4fb245d2f5 (patch)
treeb069e48cb909ac895c3952cf953a4b379cb885b5 /test/functional/eval/environ_spec.lua
parent5aa97937e7844f2d3d5e1b015e6749d1f2955697 (diff)
downloadrneovim-06d9cc734bf0397b365d5d75b1766a4fb245d2f5.tar.gz
rneovim-06d9cc734bf0397b365d5d75b1766a4fb245d2f5.tar.bz2
rneovim-06d9cc734bf0397b365d5d75b1766a4fb245d2f5.zip
exists(): return false for empty env var #10657
Fixes https://github.com/neovim/neovim/issues/3266 close #10657
Diffstat (limited to 'test/functional/eval/environ_spec.lua')
-rw-r--r--test/functional/eval/environ_spec.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/functional/eval/environ_spec.lua b/test/functional/eval/environ_spec.lua
index eb52f9e2da..4c2adcf1bf 100644
--- a/test/functional/eval/environ_spec.lua
+++ b/test/functional/eval/environ_spec.lua
@@ -2,11 +2,17 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local environ = helpers.funcs.environ
+local exists = helpers.funcs.exists
-describe('environ()', function()
- it('handles empty env variable', function()
+describe('environment variables', function()
+ it('environ() handles empty env variable', function()
clear({env={EMPTY_VAR=""}})
eq("", environ()['EMPTY_VAR'])
eq(nil, environ()['DOES_NOT_EXIST'])
end)
+ it('exists() handles empty env variable', function()
+ clear({env={EMPTY_VAR=""}})
+ eq(1, exists('$EMPTY_VAR'))
+ eq(0, exists('$DOES_NOT_EXIST'))
+ end)
end)