mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2026-03-22 06:11:26 -07:00
45 lines
831 B
Lua
45 lines
831 B
Lua
package.path = table.concat({
|
|
"./?.lua",
|
|
"./?/init.lua",
|
|
"./?/?.lua",
|
|
"./mpv-youtube-queue/?.lua",
|
|
"./mpv-youtube-queue/?/?.lua",
|
|
package.path,
|
|
}, ";")
|
|
|
|
local total = 0
|
|
local failed = 0
|
|
|
|
local function run_test(file)
|
|
local chunk, err = loadfile(file)
|
|
if not chunk then
|
|
error(err)
|
|
end
|
|
local ok, test_err = pcall(chunk)
|
|
total = total + 1
|
|
if ok then
|
|
io.write("PASS ", file, "\n")
|
|
return
|
|
end
|
|
failed = failed + 1
|
|
io.write("FAIL ", file, "\n", test_err, "\n")
|
|
end
|
|
|
|
local tests = {
|
|
"tests/app_spec.lua",
|
|
"tests/metadata_resolution_test.lua",
|
|
"tests/state_spec.lua",
|
|
"tests/history_client_spec.lua",
|
|
"tests/input_spec.lua",
|
|
}
|
|
|
|
for _, file in ipairs(tests) do
|
|
run_test(file)
|
|
end
|
|
|
|
if failed > 0 then
|
|
error(string.format("%d/%d tests failed", failed, total))
|
|
end
|
|
|
|
io.write(string.format("PASS %d tests\n", total))
|