import("test_templates")
import("test_packages")
function main(...)
local argv = table.pack(...)
local run_packages = false
local run_templates = false
local diff = try {function () return os.iorun("git --no-pager diff --name-only HEAD^") end}
if diff then
for _, file in ipairs(diff:split("\n")) do
file = file:trim()
if file:startswith("packages") then
run_packages = true
elseif file:startswith("templates") then
run_templates = true
end
end
else
run_packages = true
end
if not run_packages and not run_templates then
run_packages = true
end
if run_templates then
print("Running template tests...")
test_templates()
end
if run_packages then
print("Running package tests...")
test_packages(table.unpack(argv))
end
end