23 lines
595 B
Plaintext
23 lines
595 B
Plaintext
local fs=require("sys.fs")
|
|
local units=fs.list("/usr/lib/hunit/")
|
|
fs.mkdir("/tmp/hunit/")
|
|
local errors={}
|
|
for i,v in ipairs(units) do
|
|
print("running unit "..v)
|
|
local code=fs.readAllText("/usr/lib/hunit/"..v)
|
|
local func, err=load(code, "@"..v)
|
|
if not func then
|
|
print(" [ERROR]:"..err)
|
|
end
|
|
---@diagnostic disable-next-line: param-type-mismatch
|
|
local ok, err=pcall(func)
|
|
if not ok then
|
|
print(" [ERROR]:"..err)
|
|
table.insert(errors, v)
|
|
else
|
|
print(" [SUCCESS]")
|
|
end
|
|
end
|
|
|
|
print(tostring(#errors).." units failed")
|
|
return 0 |