test(launcher-test): cover STATE_MODAL_CONFLICT FSM transitions

Four new asserts: list -> modal_conflict via open_conflict event;
modal_conflict -> list via esc / cancel / launch_anyway. fsm.lua
updated to the launcher's v0.3.0 copy (byte-identical, smoke.sh
hash-check enforces no drift).
This commit is contained in:
Calic
2026-06-11 02:55:00 +02:00
parent f1d0aec9a5
commit d9ec4d11dc
2 changed files with 20 additions and 14 deletions

28
fsm.lua
View File

@@ -1,23 +1,23 @@
-- Sporel Launcher — pure-Lua finite state machine.
-- No engine.* calls; testable directly by lib-management.launcher-test.
local M = {}
M.STATE_LIST = "list"
M.STATE_QUIT_CONFIRM = "quit_confirm"
M.EXIT = "exit" -- sentinel: caller should engine.exit(0)
M.STATE_LIST = "list"
M.STATE_QUIT_CONFIRM = "quit_confirm"
M.STATE_MODAL_CONFLICT = "modal_conflict"
M.EXIT = "exit"
-- 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
if event == "esc" then return M.STATE_QUIT_CONFIRM end
if event == "open_conflict" then return M.STATE_MODAL_CONFLICT end
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
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
elseif state == M.STATE_MODAL_CONFLICT then
if event == "esc" then return M.STATE_LIST end
if event == "cancel" then return M.STATE_LIST end
if event == "launch_anyway" then return M.STATE_LIST end -- side-effect
end
return state
end