-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.lua
More file actions
37 lines (32 loc) · 772 Bytes
/
run.lua
File metadata and controls
37 lines (32 loc) · 772 Bytes
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
-- Running tests and/or examples
package.path = package.path .. [[lua\?.lua;lua\?\init.lua;]]
local TEST_DIR = "tests"
require "sysapi"
local function parse_args(args)
local ret = {}
for i = 1, #args do
local k, v = args[i]:match("--(%w+)=(%w+)")
if k then
ret[k] = v
end
end
return ret
end
local args = parse_args(arg)
local fs = require "fs.fs"
for path in fs.dir(TEST_DIR .. [[\*.lua]]) do
if not args.filter or path:sub(0, -5) == args.filter then
print("-------------------------")
print(path)
print("-------------------------")
local f, err = loadfile(TEST_DIR .. [[\]] .. path)
if f then
local ok, err = pcall(f)
if not ok then
print(err)
end
else
print(err)
end
end
end