diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2026-03-25 13:33:17 +0000 |
|---|---|---|
| committer | Lewis Russell <lewis6991@gmail.com> | 2026-04-15 12:09:25 +0100 |
| commit | 55f9c2136e52d8719495b6021ce7e8d64c5141fe (patch) | |
| tree | 0f2b934f30af2b232453b3e676fd9cd7f32e7957 /runtime/lua/vim/_core/shared.lua | |
| parent | e289f9579c73b4f6da105dfad87bd90e0dc6d973 (diff) | |
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 'runtime/lua/vim/_core/shared.lua')
| -rw-r--r-- | runtime/lua/vim/_core/shared.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/lua/vim/_core/shared.lua b/runtime/lua/vim/_core/shared.lua index f390e3c1e9..5237063a8d 100644 --- a/runtime/lua/vim/_core/shared.lua +++ b/runtime/lua/vim/_core/shared.lua @@ -64,6 +64,31 @@ function vim.deepcopy(orig, noref) return deepcopy(orig, not noref and {} or nil) end +--- Returns a shallow copy of `orig`. +--- +--- Non-table values are returned as-is. Table keys and values are copied by +--- reference, and the original metatable is preserved. Use |vim.deepcopy()| +--- for a recursive copy. +--- +--- @nodoc +--- @generic T +--- @param orig T +--- @return T +function vim._copy(orig) + if type(orig) ~= 'table' then + return orig + end + + --- @cast orig table<any,any> + + local copy = {} --- @type table<any,any> + for k, v in pairs(orig) do + copy[k] = v + end + + return setmetatable(copy, getmetatable(orig)) +end + --- @class vim.gsplit.Opts --- @inlinedoc --- @@ -678,6 +703,8 @@ local function deep_equal(left, right, seen) return false end + ---@cast left table<any, any> + ---@cast right table<any, any> seen = seen or {} local seen_left = seen[left] if seen_left and seen_left[right] ~= nil then |
