aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/environ_spec.lua
diff options
context:
space:
mode:
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)