diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-09-27 10:00:36 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-09-27 21:17:53 +0200 |
commit | a0ec8597e3ef01b0121af7542fc482ae8e7eeb70 (patch) | |
tree | 77986a237d0ec0cd7b02903f7a73e95b8bfc2256 /test | |
parent | 96614f84abb43ad2e6b610dfbbda4d075a2a0aad (diff) | |
download | rneovim-a0ec8597e3ef01b0121af7542fc482ae8e7eeb70.tar.gz rneovim-a0ec8597e3ef01b0121af7542fc482ae8e7eeb70.tar.bz2 rneovim-a0ec8597e3ef01b0121af7542fc482ae8e7eeb70.zip |
fix(runtime): make a copy of runtime_search_path when iterating
This is to prevent concurrent modification, just like save_rtp
in the vim 8 implementation
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/core/startup_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/fixtures/pack/foo/opt/funky/filen.lua | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 41c80ab95c..c0d9bf4539 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -358,6 +358,12 @@ describe('startup', function() pack_clear [[ lua _G.test_loadorder = {} vim.cmd "packadd! superspecial\nruntime! filen.lua" ]] eq({'ordinary', 'SuperSpecial', 'FANCY', 'FANCY after', 'SuperSpecial 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', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]]) + eq({'ordinary', 'funky!', 'ordinary after'}, exec_lua [[ return _G.nested_order ]]) + end) end) describe('sysinit', function() diff --git a/test/functional/fixtures/pack/foo/opt/funky/filen.lua b/test/functional/fixtures/pack/foo/opt/funky/filen.lua new file mode 100644 index 0000000000..a33b83c2a7 --- /dev/null +++ b/test/functional/fixtures/pack/foo/opt/funky/filen.lua @@ -0,0 +1,12 @@ +table.insert(_G.test_loadorder, "funky!") + +if not _G.nesty then + _G.nesty = true + local save_order = _G.test_loadorder + _G.test_loadorder = {} + _G.vim.o.pp = "" -- funky! + vim.cmd [[runtime! filen.lua ]] + _G.nested_order = _G.test_loadorder + _G.test_loadorder = save_order + _G.nesty = nil +end |