diff options
author | shadmansaleh <shadmansaleh3@gmail.com> | 2021-06-02 22:46:25 +0600 |
---|---|---|
committer | shadmansaleh <shadmansaleh3@gmail.com> | 2021-06-11 01:01:03 +0600 |
commit | 92b6b3764cf75d01bcbf04fcf598140fc01e7902 (patch) | |
tree | 9757b6cafef6d3be82f5a4af4578b8940e226848 /test/functional/core/startup_spec.lua | |
parent | 07c9b20c75d318dcdee9e5196bca12ee66d041ba (diff) | |
download | rneovim-92b6b3764cf75d01bcbf04fcf598140fc01e7902.tar.gz rneovim-92b6b3764cf75d01bcbf04fcf598140fc01e7902.tar.bz2 rneovim-92b6b3764cf75d01bcbf04fcf598140fc01e7902.zip |
refactor(tests): Simplify tests at functional/lua/runtime_spec
Diffstat (limited to 'test/functional/core/startup_spec.lua')
-rw-r--r-- | test/functional/core/startup_spec.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index d5f03db03a..30c0758446 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -11,6 +11,7 @@ local exec_lua = helpers.exec_lua local feed = helpers.feed local funcs = helpers.funcs local mkdir = helpers.mkdir +local mkdir_p = helpers.mkdir_p local nvim_prog = helpers.nvim_prog local nvim_set = helpers.nvim_set local read_file = helpers.read_file @@ -494,6 +495,62 @@ describe('user config init', function() end) end) +describe('runtime:', function() + local xhome = 'Xhome' + local pathsep = helpers.get_pathsep() + local xconfig = xhome .. pathsep .. 'Xconfig' + + setup(function() + mkdir_p(xconfig .. pathsep .. 'nvim') + end) + + teardown(function() + rmdir(xhome) + end) + + it('loads plugin/*.lua from XDG config home', function() + local plugin_folder_path = table.concat({xconfig, 'nvim', 'plugin'}, pathsep) + local plugin_file_path = table.concat({plugin_folder_path, 'plugin.lua'}, pathsep) + mkdir_p(plugin_folder_path) + write_file(plugin_file_path, [[ vim.g.lua_plugin = 1 ]]) + + clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig }} + + eq(1, eval('g:lua_plugin')) + rmdir(plugin_folder_path) + end) + + it('loads plugin/*.lua from start plugins', function() + local plugin_path = table.concat({xconfig, 'nvim', 'pack', 'catagory', + 'start', 'test_plugin'}, pathsep) + local plugin_folder_path = table.concat({plugin_path, 'plugin'}, pathsep) + local plugin_file_path = table.concat({plugin_folder_path, 'plugin.lua'}, + pathsep) + mkdir_p(plugin_folder_path) + write_file(plugin_file_path, [[vim.g.lua_plugin = 2]]) + + clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig }} + + eq(2, eval('g:lua_plugin')) + rmdir(plugin_path) + end) + + it('loads ftdetect/*.lua', function() + local ftdetect_folder = table.concat({xconfig, 'nvim', 'ftdetect'}, pathsep) + local ftdetect_file = table.concat({ftdetect_folder , 'new-ft.lua'}, pathsep) + mkdir_p(ftdetect_folder) + write_file(ftdetect_file , [[vim.g.lua_ftdetect = 1]]) + + -- TODO(shadmansaleh): Figure out why this test fails without + -- setting VIMRUNTIME + clear{ args_rm={'-u'}, env={XDG_CONFIG_HOME=xconfig, + VIMRUNTIME='runtime/'}} + + eq(1, eval('g:lua_ftdetect')) + rmdir(ftdetect_folder) + end) +end) + describe('user session', function() local xhome = 'Xhome' local pathsep = helpers.get_pathsep() |