Files
ReSkate/contrib/plugins/reskate-test/plugin/main.lua
T
AyeZeeBB a3e75ba10e Plugins: the reskate-test and reskate-hostile plugins, and trick reading and a facing teleport in the core
- contrib/plugins/reskate-test calls every plugin API and says what worked: ptest all, ptest
  <module>, ptest list. Its 45 checks cover the base set, timers, the level, package files, JSON,
  require, the console, storage and the sandbox. It is the example to copy for a plugin.
- contrib/plugins/reskate-hostile attacks the sandbox, one attack per command (hostile list):
  loops, memory and buffer bombs, caught errors, error and log floods, timers, recursion, an
  unload that never ends, and 17 ways out. Each must end stopped or refused.
- dingosdk_plugin_tests runs both from the repository: every reskate-test check passes, and every
  hostile attack is stopped or refused with nothing escaping.
- Taken from Domination (PR 279) for the plugin API to use: the trick watch (when a trick starts,
  lands and what it scored, or a slam breaks it; Domination's spots left out) in
  Extension/Skater/trick_watch.h with its tests, the score HUD reader in score_hud.h, and
  teleport_local_skater_heading, whose hunks are the PR's own. Neither is wired to anything yet.
2026-10-19 12:08:26 -05:00

23 lines
954 B
Lua

-- reskate-test: calls every plugin API and says what worked. Run `ptest all` in the console, or
-- `ptest <module>` for one (`ptest list` names them). Each API ReSkate adds gets a module here.
local harness = require("harness")
for _, name in {"base", "time", "level", "package", "json", "require", "console", "storage", "sandbox"} do
require("checks/" .. name)
end
reskate.console.command("ptest", "Checks the plugin API: ptest all, ptest <module>, ptest list", function(args)
local what = args[1] or "all"
if what == "list" then
reskate.console.print("ptest modules: " .. table.concat(harness.names(), ", "))
elseif what == "all" then
harness.run(harness.names())
elseif harness.has(what) then
harness.run({what})
else
reskate.console.print("ptest: there is no module " .. what .. " (ptest list names them)")
end
end)
reskate.log("reskate-test loaded: ptest all checks every plugin API")