Files
sporel-lib-management.launc…/fsm.lua
Calic d9ec4d11dc 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).
2026-06-11 02:55:00 +02:00

26 lines
952 B
Lua

local M = {}
M.STATE_LIST = "list"
M.STATE_QUIT_CONFIRM = "quit_confirm"
M.STATE_MODAL_CONFLICT = "modal_conflict"
M.EXIT = "exit"
function M.next(state, event)
if state == M.STATE_LIST then
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
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
return M