test: pcall-wrap panel-spy restoration in section 12
Wraps the section-12 test body in pcall so the panel-spy restoration runs unconditionally. Prevents spy-state leaking into subsequent tests if section-12 fails. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
8
init.lua
8
init.lua
@@ -371,6 +371,9 @@ function M.run_tests(_ctx)
|
||||
captured_entries = entries
|
||||
end
|
||||
|
||||
local f1_ok = false
|
||||
local f2_ok = false
|
||||
local body_ok, body_err = pcall(function()
|
||||
-- Form-1 path
|
||||
local container12a = fresh_container{
|
||||
{ template = "craft_display_test.rock", count = 1 },
|
||||
@@ -380,7 +383,6 @@ function M.run_tests(_ctx)
|
||||
widget12a._captured = { rid = rid, ctx_inner = ctx_inner }
|
||||
end)
|
||||
display._invoke_context_menu(widget12a, "alias_r12", 0, 0)
|
||||
local f1_ok = false
|
||||
if captured_entries and #captured_entries == 1 then
|
||||
captured_entries[1].callback({ close_menu = function() end })
|
||||
local cap = widget12a._captured
|
||||
@@ -402,7 +404,6 @@ function M.run_tests(_ctx)
|
||||
widget12b._captured = { rid = rid, ctx_inner = ctx_inner }
|
||||
end)
|
||||
display._invoke_context_menu(widget12b, "alias_r12", 0, 0)
|
||||
local f2_ok = false
|
||||
if captured_entries and #captured_entries == 1 then
|
||||
captured_entries[1].callback({ close_menu = function() end })
|
||||
local cap = widget12b._captured
|
||||
@@ -411,9 +412,12 @@ function M.run_tests(_ctx)
|
||||
and cap.ctx_inner.locale == locale_table12
|
||||
and cap.ctx_inner.container == c12b_src2 -- sink alias
|
||||
end
|
||||
end)
|
||||
|
||||
panel.show_context_menu = saved_show
|
||||
|
||||
if not body_ok then error(body_err, 0) end
|
||||
|
||||
T.assert(f1_ok and f2_ok,
|
||||
"12. ctx_inner carries locale + container alias: Form-1 (handle == "
|
||||
.. "locale == container); Form-2 (locale==table, container==sink)")
|
||||
|
||||
Reference in New Issue
Block a user