refactor: split script into modules and drop queue save/load
All checks were successful
Luacheck / luacheck (push) Successful in 58s

This commit is contained in:
2026-03-08 21:35:16 -07:00
parent dd50f3eaad
commit 236f4ab39e
20 changed files with 2222 additions and 1256 deletions

44
tests/run.lua Normal file
View 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))