2019-07-30 02:55:55 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
|
|
|
local clear = helpers.clear
|
|
|
|
local eq = helpers.eq
|
|
|
|
local environ = helpers.funcs.environ
|
2019-07-30 02:37:39 -07:00
|
|
|
local exists = helpers.funcs.exists
|
2019-07-30 02:55:55 -07:00
|
|
|
|
2019-07-30 02:37:39 -07:00
|
|
|
describe('environment variables', function()
|
|
|
|
it('environ() handles empty env variable', function()
|
2019-07-30 02:55:55 -07:00
|
|
|
clear({env={EMPTY_VAR=""}})
|
|
|
|
eq("", environ()['EMPTY_VAR'])
|
|
|
|
eq(nil, environ()['DOES_NOT_EXIST'])
|
|
|
|
end)
|
2019-07-30 02:37:39 -07:00
|
|
|
it('exists() handles empty env variable', function()
|
2019-08-10 02:48:36 -07:00
|
|
|
clear({env={EMPTY_VAR=""}})
|
|
|
|
eq(1, exists('$EMPTY_VAR'))
|
2019-07-30 02:37:39 -07:00
|
|
|
eq(0, exists('$DOES_NOT_EXIST'))
|
|
|
|
end)
|
2019-07-30 02:55:55 -07:00
|
|
|
end)
|