-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntest.lua
43 lines (34 loc) · 886 Bytes
/
runtest.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- test entry point
package.path = package.path .. ";/bin/?.lua"
function concat(...)
local res = {}
local args = {...}
for i, arg in ipairs(args) do
for j, v in ipairs(arg) do
table.insert(res, v)
end
end
return res
end
local tests = concat(
fs.find("bin/*/*_test.lua"),
fs.find("bin/*_test.lua")
)
local logger = fs.open("test-result", "w")
local buffer = ""
function print(obj)
buffer = buffer .. obj
logger.writeLine(obj)
end
for i, f in ipairs(tests) do
for mod in string.gmatch(f, "(bin/.+_test).lua") do
local result = require(mod)
print("# test for " .. mod)
print(result:resultText())
print("-------")
print(result:failuresText())
print(result:succeededCount() .. " / " .. result:caseCount())
end
end
-- textutils.pagedPrint(buffer)
logger.close()