aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/vim_spec.lua12
-rw-r--r--test/functional/core/startup_spec.lua36
-rw-r--r--test/functional/fixtures/nvim/after/filen.lua1
-rw-r--r--test/functional/fixtures/nvim/filen.lua1
-rw-r--r--test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua1
-rw-r--r--test/functional/fixtures/pack/foo/opt/superspecial/filen.lua1
-rw-r--r--test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua1
-rw-r--r--test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua1
8 files changed, 50 insertions, 4 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 83b256e935..ffef6a6066 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1591,7 +1591,10 @@ describe('API', function()
eq({'a', '', 'b'}, meths.list_runtime_paths())
meths.set_option('runtimepath', ',a,b')
eq({'', 'a', 'b'}, meths.list_runtime_paths())
+ -- trailing , is ignored, use ,, if you really really want $CWD
meths.set_option('runtimepath', 'a,b,')
+ eq({'a', 'b'}, meths.list_runtime_paths())
+ meths.set_option('runtimepath', 'a,b,,')
eq({'a', 'b', ''}, meths.list_runtime_paths())
end)
it('truncates too long paths', function()
@@ -2012,8 +2015,13 @@ describe('API', function()
ok(endswith(val[1], p"autoload/remote/define.vim")
or endswith(val[1], p"autoload/remote/host.vim"))
- eq({}, meths.get_runtime_file("lua", true))
- eq({}, meths.get_runtime_file("lua/vim", true))
+ val = meths.get_runtime_file("lua", true)
+ eq(1, #val)
+ ok(endswith(val[1], p"lua"))
+
+ val = meths.get_runtime_file("lua/vim", true)
+ eq(1, #val)
+ ok(endswith(val[1], p"lua/vim"))
end)
it('can find directories', function()
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 861889e7fc..f057420dde 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -310,7 +310,7 @@ describe('startup', function()
end)
local function pack_clear(cmd)
- clear('--cmd', 'set packpath=test/functional/fixtures', '--cmd', cmd)
+ clear{args={'--cmd', 'set packpath=test/functional/fixtures', '--cmd', cmd}, env={XDG_CONFIG_HOME='test/functional/fixtures/'}}
end
@@ -348,6 +348,16 @@ describe('startup', function()
pack_clear [[ packadd! bonus | lua _G.y = require'bonus'.launch() ]]
eq('CPE 1704 TKS', exec_lua [[ return _G.y ]])
end)
+
+ it("handles the correct order with start packages and after/", function()
+ pack_clear [[ lua _G.test_loadorder = {} vim.cmd "runtime! filen.lua" ]]
+ eq({'ordinary', 'FANCY', 'ordinary after', 'FANCY after'}, exec_lua [[ return _G.test_loadorder ]])
+ end)
+
+ it("handles the correct order with opt packages and after/", function()
+ pack_clear [[ lua _G.test_loadorder = {} vim.cmd "packadd! superspecial\nruntime! filen.lua" ]]
+ eq({'ordinary', 'SuperSpecial', 'FANCY', 'SuperSpecial after', 'ordinary after', 'FANCY after'}, exec_lua [[ return _G.test_loadorder ]])
+ end)
end)
describe('sysinit', function()
@@ -504,6 +514,7 @@ describe('runtime:', function()
local xenv = { XDG_CONFIG_HOME=xconfig, XDG_DATA_HOME=xdata }
setup(function()
+ rmdir(xhome)
mkdir_p(xconfig .. pathsep .. 'nvim')
mkdir_p(xdata)
end)
@@ -524,7 +535,7 @@ describe('runtime:', function()
rmdir(plugin_folder_path)
end)
- it('loads plugin/*.lua from start plugins', function()
+ it('loads plugin/*.lua from start packages', function()
local plugin_path = table.concat({xconfig, 'nvim', 'pack', 'catagory',
'start', 'test_plugin'}, pathsep)
local plugin_folder_path = table.concat({plugin_path, 'plugin'}, pathsep)
@@ -552,6 +563,27 @@ describe('runtime:', function()
rmdir(plugin_path)
end)
+ it('loads plugin/*.lua from site packages', function()
+ local nvimdata = iswin() and "nvim-data" or "nvim"
+ local plugin_path = table.concat({xdata, nvimdata, 'site', 'pack', 'xa', 'start', 'yb'}, pathsep)
+ local plugin_folder_path = table.concat({plugin_path, 'plugin'}, pathsep)
+ local plugin_after_path = table.concat({plugin_path, 'after', 'plugin'}, pathsep)
+ local plugin_file_path = table.concat({plugin_folder_path, 'plugin.lua'}, pathsep)
+ local plugin_after_file_path = table.concat({plugin_after_path, 'helloo.lua'}, pathsep)
+
+ mkdir_p(plugin_folder_path)
+ write_file(plugin_file_path, [[table.insert(_G.lista, "unos")]])
+ mkdir_p(plugin_after_path)
+ write_file(plugin_after_file_path, [[table.insert(_G.lista, "dos")]])
+
+ clear{ args_rm={'-u'}, args={'--cmd', 'lua _G.lista = {}'}, env=xenv }
+
+ eq({'unos', 'dos'}, exec_lua "return _G.lista")
+
+ 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)
diff --git a/test/functional/fixtures/nvim/after/filen.lua b/test/functional/fixtures/nvim/after/filen.lua
new file mode 100644
index 0000000000..0128a0a16a
--- /dev/null
+++ b/test/functional/fixtures/nvim/after/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "ordinary after")
diff --git a/test/functional/fixtures/nvim/filen.lua b/test/functional/fixtures/nvim/filen.lua
new file mode 100644
index 0000000000..e2bd5e8f7f
--- /dev/null
+++ b/test/functional/fixtures/nvim/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "ordinary")
diff --git a/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua b/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua
new file mode 100644
index 0000000000..94bf6850b2
--- /dev/null
+++ b/test/functional/fixtures/pack/foo/opt/superspecial/after/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "SuperSpecial after")
diff --git a/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua b/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua
new file mode 100644
index 0000000000..cbaab1a45a
--- /dev/null
+++ b/test/functional/fixtures/pack/foo/opt/superspecial/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "SuperSpecial")
diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua
new file mode 100644
index 0000000000..9beac762ee
--- /dev/null
+++ b/test/functional/fixtures/pack/foo/start/fancyplugin/after/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "FANCY after")
diff --git a/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua b/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua
new file mode 100644
index 0000000000..34e4b9c95e
--- /dev/null
+++ b/test/functional/fixtures/pack/foo/start/fancyplugin/filen.lua
@@ -0,0 +1 @@
+table.insert(_G.test_loadorder, "FANCY")