aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorshadmansaleh <13149513+shadmansaleh@users.noreply.github.com>2022-02-12 10:54:25 +0600
committershadmansaleh <13149513+shadmansaleh@users.noreply.github.com>2022-02-13 01:23:23 +0600
commitf292dd2126f8dacd6446799ac750ab368b852f81 (patch)
treeaea236d948d39ba14619322ab7d5fe6df438d592 /test/functional/lua/vim_spec.lua
parentf89f4b1e12d97a78a86efbe80b23bf60f4d07d73 (diff)
downloadrneovim-f292dd2126f8dacd6446799ac750ab368b852f81.tar.gz
rneovim-f292dd2126f8dacd6446799ac750ab368b852f81.tar.bz2
rneovim-f292dd2126f8dacd6446799ac750ab368b852f81.zip
fix: autoload variables not loaded with vim.g & nvim_get_var
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 17f7a04db6..7ec986acdd 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -19,6 +19,9 @@ local NIL = helpers.NIL
local retry = helpers.retry
local next_msg = helpers.next_msg
local remove_trace = helpers.remove_trace
+local mkdir_p = helpers.mkdir_p
+local rmdir = helpers.rmdir
+local write_file = helpers.write_file
before_each(clear)
@@ -1019,6 +1022,20 @@ describe('lua stdlib', function()
eq(3, exec_lua([[return vim.g.GetCounter()]]))
exec_lua([[vim.api.nvim_get_var('AddCounter')()]])
eq(4, exec_lua([[return vim.api.nvim_get_var('GetCounter')()]]))
+
+ -- Check if autoload works properly
+ local pathsep = helpers.get_pathsep()
+ local xconfig = 'Xhome' .. pathsep .. 'Xconfig'
+ local xdata = 'Xhome' .. pathsep .. 'Xdata'
+ local autoload_folder = table.concat({xconfig, 'nvim', 'autoload'}, pathsep)
+ local autoload_file = table.concat({autoload_folder , 'testload.vim'}, pathsep)
+ mkdir_p(autoload_folder)
+ write_file(autoload_file , [[let testload#value = 2]])
+
+ clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig, XDG_DATA_HOME=xdata } }
+
+ eq(2, exec_lua("return vim.g['testload#value']"))
+ rmdir('Xhome')
end)
it('vim.b', function()