From c9264e6d524b3c2ac1a1388d5627f9b0c717cbc7 Mon Sep 17 00:00:00 2001 From: erw7 Date: Thu, 7 Mar 2019 13:41:40 +0900 Subject: Fix os.getenv of lua on Windows Change to use os_getenv instead of getenv because environment variable set by uv_os_setenv can not be get with getenv. --- test/functional/lua/overrides_spec.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index 007d40874f..e9d7f3355a 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -300,3 +300,19 @@ describe('package.path/package.cpath', function() eq(new_paths_str, eval_lua('package.path'):sub(1, #new_paths_str)) end) end) + +describe('os.getenv', function() + it('returns nothing for not set env var', function() + eq(NIL, funcs.luaeval('os.getenv("XTEST_1")')) + end) + it('returns env var set by the parent process', function() + local value = 'foo' + clear({env = {['XTEST_1']=value}}) + eq(value, funcs.luaeval('os.getenv("XTEST_1")')) + end) + it('returns env var set by let', function() + local value = 'foo' + meths.command('let $XTEST_1 = "'..value..'"') + eq(value, funcs.luaeval('os.getenv("XTEST_1")')) + end) +end) -- cgit