fix(P.3.4): self-contained fsm.lua, drop module-dep (resolver only handles libs)

Sporel resolver does NOT resolve module-as-dep (only lib-deps). Test-module
ships its own byte-identical copy of fsm.lua and loads it via dir_of(self).
Drift prevention deferred to Smoke diff-check (next slice).

Also dropped runtime-behavior measure_text assertion (needs Raylib font, not
loaded in headless test-mode). Existence-check (assertion 10) is sufficient.

11 assertions: 5 FSM transitions + 1 FSM stability + 5 Engine-Surface existence.
This commit is contained in:
Calic
2026-05-12 23:25:16 +02:00
parent b27911484e
commit 1aa2eb6a6a
3 changed files with 33 additions and 8 deletions

25
fsm.lua Normal file
View File

@@ -0,0 +1,25 @@
-- Sporel Launcher — pure-Lua finite state machine.
-- No engine.* calls; testable directly by lib-sporel.launcher-test.
local M = {}
M.STATE_LIST = "list"
M.STATE_QUIT_CONFIRM = "quit_confirm"
M.EXIT = "exit" -- sentinel: caller should engine.exit(0)
-- Events: "esc", "enter", "click_yes", "click_no", "click_module"
function M.next(state, event)
if state == M.STATE_LIST then
if event == "esc" then return M.STATE_QUIT_CONFIRM end
return M.STATE_LIST
elseif state == M.STATE_QUIT_CONFIRM then
if event == "esc" then return M.STATE_LIST end
if event == "enter" then return M.EXIT end
if event == "click_yes" then return M.EXIT end
if event == "click_no" then return M.STATE_LIST end
return M.STATE_QUIT_CONFIRM
end
return state
end
return M

View File

@@ -1,8 +1,13 @@
-- lib-sporel.launcher-test — P.3.4 -- lib-sporel.launcher-test — P.3.4
-- 12 assertions: 5 FSM transitions + 1 FSM stability + 6 Engine-Surface existence. -- 11 assertions: 5 FSM transitions + 1 FSM stability + 5 Engine-Surface existence.
-- (measure_text runtime-behavior check dropped — needs Raylib font, not loaded in headless test-mode.)
-- Pattern follows P.3.1 Test-Module-Pattern; TAP output via engine.test.* -- Pattern follows P.3.1 Test-Module-Pattern; TAP output via engine.test.*
local fsm = dofile(engine.module.dir_of("lib-sporel.launcher") .. "/fsm.lua") -- FSM-Source: byte-identical Kopie aus modules/lib-sporel.launcher/fsm.lua.
-- Sporel-Resolver lehnt module-als-dep ab (nur lib-deps werden resolved),
-- daher hat dieses Test-Modul seine eigene fsm.lua. Drift wird via Smoke-
-- diff-check verhindert (siehe smoke.sh P0-S15-pre).
local fsm = dofile(engine.module.dir_of("lib-sporel.launcher-test") .. "/fsm.lua")
function init(ctx) function init(ctx)
-- FSM transitions (5) -- FSM transitions (5)
@@ -21,6 +26,4 @@ function init(ctx)
engine.test.assert(type(engine.render.draw_text) == "function", "engine.render.draw_text is function") engine.test.assert(type(engine.render.draw_text) == "function", "engine.render.draw_text is function")
engine.test.assert(type(engine.render.measure_text) == "function", "engine.render.measure_text is function") engine.test.assert(type(engine.render.measure_text) == "function", "engine.render.measure_text is function")
engine.test.assert(type(engine.module.list()) == "table", "engine.module.list() returns table") engine.test.assert(type(engine.module.list()) == "table", "engine.module.list() returns table")
local w, h = engine.render.measure_text("Test", 20)
engine.test.assert(w > 0 and h > 0, "measure_text returns positive dimensions")
end end

View File

@@ -4,8 +4,5 @@
"kind": "test-module", "kind": "test-module",
"api": "^0.1", "api": "^0.1",
"entry_point": "init.lua", "entry_point": "init.lua",
"deps": [ "deps": []
{ "id": "lib-sporel.launcher", "version": "0.1.0" },
{ "id": "lib-core.input", "version": "0.3.0" }
]
} }