mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
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.
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user