mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2026-03-22 18:11:27 -07:00
refactor: split script into modules and drop queue save/load
All checks were successful
Luacheck / luacheck (push) Successful in 58s
All checks were successful
Luacheck / luacheck (push) Successful in 58s
This commit is contained in:
44
tests/run.lua
Normal file
44
tests/run.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
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))
|
||||
Reference in New Issue
Block a user