mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
fix(runtime): add packages as "/pack/*/start/*" patterns to &rtp
This makes `globpath(&rtp, ...)` work again for start packages
This commit is contained in:
@@ -12,10 +12,12 @@ local funcs = helpers.funcs
|
||||
local iswin = helpers.iswin
|
||||
local meths = helpers.meths
|
||||
local matches = helpers.matches
|
||||
local mkdir_p = helpers.mkdir_p
|
||||
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
|
||||
local is_os = helpers.is_os
|
||||
local parse_context = helpers.parse_context
|
||||
local request = helpers.request
|
||||
local rmdir = helpers.rmdir
|
||||
local source = helpers.source
|
||||
local next_msg = helpers.next_msg
|
||||
local tmpname = helpers.tmpname
|
||||
@@ -1574,6 +1576,18 @@ describe('API', function()
|
||||
end)
|
||||
|
||||
describe('nvim_list_runtime_paths', function()
|
||||
setup(function()
|
||||
local pathsep = helpers.get_pathsep()
|
||||
mkdir_p('Xtest'..pathsep..'a')
|
||||
mkdir_p('Xtest'..pathsep..'b')
|
||||
end)
|
||||
teardown(function()
|
||||
rmdir 'Xtest'
|
||||
end)
|
||||
before_each(function()
|
||||
meths.set_current_dir 'Xtest'
|
||||
end)
|
||||
|
||||
it('returns nothing with empty &runtimepath', function()
|
||||
meths.set_option('runtimepath', '')
|
||||
eq({}, meths.list_runtime_paths())
|
||||
@@ -1601,8 +1615,7 @@ describe('API', function()
|
||||
local long_path = ('/a'):rep(8192)
|
||||
meths.set_option('runtimepath', long_path)
|
||||
local paths_list = meths.list_runtime_paths()
|
||||
neq({long_path}, paths_list)
|
||||
eq({long_path:sub(1, #(paths_list[1]))}, paths_list)
|
||||
eq({}, paths_list)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ local retry = helpers.retry
|
||||
local rmdir = helpers.rmdir
|
||||
local sleep = helpers.sleep
|
||||
local iswin = helpers.iswin
|
||||
local startswith = helpers.startswith
|
||||
local write_file = helpers.write_file
|
||||
local meths = helpers.meths
|
||||
|
||||
@@ -355,11 +356,50 @@ describe('startup', function()
|
||||
eq({'ordinary', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
end)
|
||||
|
||||
it("handles the correct order with start packages and after/ after startup", function()
|
||||
pack_clear [[ lua _G.test_loadorder = {} ]]
|
||||
command [[ runtime! filen.lua ]]
|
||||
eq({'ordinary', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
end)
|
||||
|
||||
it("handles the correct order with globpath(&rtp, ...)", function()
|
||||
pack_clear [[ set loadplugins | lua _G.test_loadorder = {} ]]
|
||||
command [[
|
||||
for x in globpath(&rtp, "filen.lua",1,1)
|
||||
call v:lua.dofile(x)
|
||||
endfor
|
||||
]]
|
||||
eq({'ordinary', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
|
||||
local rtp = meths.get_option'rtp'
|
||||
ok(startswith(rtp, 'test/functional/fixtures/nvim,test/functional/fixtures/pack/*/start/*,test/functional/fixtures/start/*,test/functional/fixtures,test/functional/fixtures/middle,'), 'rtp='..rtp)
|
||||
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', 'mittel', 'FANCY after', 'SuperSpecial after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
end)
|
||||
|
||||
it("handles the correct order with opt packages and after/ after startup", function()
|
||||
pack_clear [[ lua _G.test_loadorder = {} ]]
|
||||
command [[
|
||||
packadd! superspecial
|
||||
runtime! filen.lua
|
||||
]]
|
||||
eq({'ordinary', 'SuperSpecial', 'FANCY', 'mittel', 'FANCY after', 'SuperSpecial after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
end)
|
||||
|
||||
it("handles the correct order with opt packages and globpath(&rtp, ...)", function()
|
||||
pack_clear [[ set loadplugins | lua _G.test_loadorder = {} ]]
|
||||
command [[
|
||||
packadd! superspecial
|
||||
for x in globpath(&rtp, "filen.lua",1,1)
|
||||
call v:lua.dofile(x)
|
||||
endfor
|
||||
]]
|
||||
eq({'ordinary', 'SuperSpecial', 'FANCY', 'mittel', 'SuperSpecial after', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
end)
|
||||
|
||||
it("handles the correct order with a package that changes packpath", function()
|
||||
pack_clear [[ lua _G.test_loadorder = {} vim.cmd "packadd! funky\nruntime! filen.lua" ]]
|
||||
eq({'ordinary', 'funky!', 'FANCY', 'mittel', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]])
|
||||
|
||||
Reference in New Issue
Block a user