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
This commit is contained in:
Lewis Russell
2026-03-25 13:33:17 +00:00
parent e289f9579c
commit 55f9c2136e
45 changed files with 3899 additions and 659 deletions

View File

@@ -8,7 +8,6 @@ local api = n.api
local fn = n.fn
local clear = n.clear
local eq = t.eq
local fail = t.fail
local exec_lua = n.exec_lua
local feed = n.feed
local expect_events = t.expect_events
@@ -507,7 +506,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
for _, event in ipairs(events) do
for _, elem in ipairs(event) do
if type(elem) == 'number' and elem < 0 then
fail(string.format('Received event has negative values'))
error('Received event has negative values')
end
end

View File

@@ -199,7 +199,7 @@ describe('vim.net.request', function()
return result
]])
assert.is_table(headers)
t.eq('table', type(headers), 'Expected headers to be a table')
-- httpbingo.org/request returns each header as a list in the returned value
t.eq(headers.Authorization[1], 'Bearer test-token', 'Expected Authorization header')
t.eq(headers['X-Custom-Header'][1], 'custom-value', 'Expected X-Custom-Header')

View File

@@ -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) ]])