aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2026-03-25 13:33:17 +0000
committerLewis Russell <lewis6991@gmail.com>2026-04-15 12:09:25 +0100
commit55f9c2136e52d8719495b6021ce7e8d64c5141fe (patch)
tree0f2b934f30af2b232453b3e676fd9cd7f32e7957 /test/functional/lua/vim_spec.lua
parente289f9579c73b4f6da105dfad87bd90e0dc6d973 (diff)
downloadrneovim-55f9c2136e52d8719495b6021ce7e8d64c5141fe.tar.gz
rneovim-55f9c2136e52d8719495b6021ce7e8d64c5141fe.tar.bz2
rneovim-55f9c2136e52d8719495b6021ce7e8d64c5141fe.zip
test: replace busted with local harness
Replace the busted-based Lua test runner with a repo-local harness. The new harness runs spec files directly under `nvim -ll`, ships its own reporter and lightweight `luassert` shim, and keeps the helper/preload flow used by the functional and unit test suites. Keep the file boundary model shallow and busted-like by restoring `_G`, `package.loaded`, `package.preload`, `arg`, and the process environment between files, without carrying extra reset APIs or custom assertion machinery. Update the build and test entrypoints to use the new runner, add black-box coverage for the harness itself, and drop the bundled busted/luacheck dependency path. AI-assisted: Codex
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index e9a1779367..2fde79a806 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -834,6 +834,26 @@ describe('lua stdlib', function()
)
end)
+ it('vim._copy', function()
+ ok(exec_lua([[
+ local inner = { x = 1 }
+ local mt = { tag = true }
+ local a = setmetatable({ inner = inner }, mt)
+ local b = vim._copy(a)
+
+ local c = vim.empty_dict()
+ c.inner = inner
+ local d = vim._copy(c)
+
+ return b ~= a
+ and b.inner == inner
+ and getmetatable(b) == mt
+ and d ~= c
+ and d.inner == inner
+ and not vim.islist(d)
+ ]]))
+ end)
+
it('vim.pesc', function()
eq('foo%-bar', exec_lua([[return vim.pesc('foo-bar')]]))
eq('foo%%%-bar', exec_lua([[return vim.pesc(vim.pesc('foo-bar'))]]))
@@ -1249,7 +1269,11 @@ describe('lua stdlib', function()
eq(true, exec_lua [[ return vim.deep_equal({a={b=1}}, {a={b=1}}) ]])
eq(true, exec_lua [[ return vim.deep_equal({a={b={nil}}}, {a={b={}}}) ]])
eq(true, exec_lua [[ return vim.deep_equal({a=1, [5]=5}, {nil,nil,nil,nil,5,a=1}) ]])
- eq(true, exec_lua [[ local shared = {}; return vim.deep_equal({ 1, shared, 1, shared }, { 1, {}, 1, {} }) ]])
+ eq(
+ true,
+ exec_lua [[ local shared = {}; return vim.deep_equal({ 1, shared, 1, shared }, { 1, {}, 1, {} }) ]]
+ )
+ -- cyclic table
eq(true, exec_lua [[ local a,b={},{}; a[1]=a; b[1]=b; return vim.deep_equal(a, b) ]])
eq(false, exec_lua [[ return vim.deep_equal(1, {nil,nil,nil,nil,5,a=1}) ]])
eq(false, exec_lua [[ return vim.deep_equal(1, 3) ]])