test/environ_spec: Windows treats empty as undefined

ref #10657
This commit is contained in:
Justin M. Keyes 2019-08-10 01:43:37 +02:00
parent 43a8242cd5
commit 396a3945c4
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ local clear = helpers.clear
local eq = helpers.eq
local environ = helpers.funcs.environ
local exists = helpers.funcs.exists
local iswin = helpers.iswin
describe('environment variables', function()
it('environ() handles empty env variable', function()
@ -11,8 +12,8 @@ describe('environment variables', function()
eq(nil, environ()['DOES_NOT_EXIST'])
end)
it('exists() handles empty env variable', function()
clear({env={EMPTY_VAR=""}})
eq(1, exists('$EMPTY_VAR'))
clear({env={EMPTY_VAR=""}}) -- Windows treats this as "undefined".
eq((iswin() and 0 or 1), exists('$EMPTY_VAR'))
eq(0, exists('$DOES_NOT_EXIST'))
end)
end)