Untested POC
This commit is contained in:
parent
461318a656
commit
bfb9b61194
5 changed files with 254 additions and 0 deletions
60
test_runner.lua
Executable file
60
test_runner.lua
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
exec nvim --headless "$0" "$@"
|
||||
|
||||
-- Set up Lua path
|
||||
package.path = "./lua/?.lua;./lua/?/init.lua;" .. package.path
|
||||
|
||||
-- Mock minimal vim global for testing
|
||||
_G.vim = {
|
||||
fn = {
|
||||
stdpath = function(type)
|
||||
return "/tmp/notex_test"
|
||||
end,
|
||||
getpid = function()
|
||||
return 12345
|
||||
end,
|
||||
},
|
||||
loop = {
|
||||
fs_stat = function(path)
|
||||
-- Mock file stat
|
||||
return {type = "file", size = 100}
|
||||
end,
|
||||
timer_start = function(delay, callback)
|
||||
return 1 -- mock timer id
|
||||
end,
|
||||
timer_stop = function(timer_id)
|
||||
-- Mock timer stop
|
||||
end,
|
||||
},
|
||||
uv = {
|
||||
new_timer = function()
|
||||
return {
|
||||
start = function() end,
|
||||
stop = function() end,
|
||||
close = function() end
|
||||
}
|
||||
end,
|
||||
hrtime = function()
|
||||
return os.clock() * 1e9
|
||||
end,
|
||||
},
|
||||
trim = function(str)
|
||||
return str:match("^%s*(.-)%s*$")
|
||||
end,
|
||||
split = function(str, sep)
|
||||
local fields = {}
|
||||
local pattern = string.format("([^%s]+)", sep)
|
||||
str:gsub(pattern, function(c) fields[#fields + 1] = c end)
|
||||
return fields
|
||||
end,
|
||||
tbl_contains = function(t, val)
|
||||
for _, v in ipairs(t) do
|
||||
if v == val then return true end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
}
|
||||
|
||||
-- Run busted with command line args
|
||||
local busted = require('busted')
|
||||
busted.run(arg)
|
Loading…
Add table
Add a link
Reference in a new issue