aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/overrides_spec.lua
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-03-07 13:41:40 +0900
committererw7 <erw7.github@gmail.com>2019-03-07 13:49:02 +0900
commitc9264e6d524b3c2ac1a1388d5627f9b0c717cbc7 (patch)
tree318dde04bcbc05f351955717cc0e101b8890613c /test/functional/lua/overrides_spec.lua
parent24a56cca308621a5a585f73b22e5421461318b3d (diff)
downloadrneovim-c9264e6d524b3c2ac1a1388d5627f9b0c717cbc7.tar.gz
rneovim-c9264e6d524b3c2ac1a1388d5627f9b0c717cbc7.tar.bz2
rneovim-c9264e6d524b3c2ac1a1388d5627f9b0c717cbc7.zip
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.
Diffstat (limited to 'test/functional/lua/overrides_spec.lua')
-rw-r--r--test/functional/lua/overrides_spec.lua16
1 files changed, 16 insertions, 0 deletions
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)