summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/run.lua56
1 files changed, 55 insertions, 1 deletions
diff --git a/tests/run.lua b/tests/run.lua
index ea0d207..9bb4b26 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -5760,6 +5760,60 @@ test("Escape acquisition stays outside highlight timer start", function()
end
end)
+test("Target-plan errors remain inside acquisition cleanup guard", function()
+ local state, transitions = fresh_sequence_state()
+ local prior = {
+ hidden = false,
+ guicursor = "n:block,i:ver25",
+ terminal_cursor_visible = true,
+ }
+ local host = MemoryHost.new({
+ buffer_lines = { "abc" },
+ cursor_presentation = prior,
+ configuration = {
+ mark_cursor = true,
+ mark_direct = true,
+ mark_char = false,
+ show_prompt = true,
+ },
+ input_packets = { { kind = "text", text = "a" } },
+ })
+ local target_factory = {
+ build = function()
+ error("search planning failed", 0)
+ end,
+ }
+ local service = acquisition_service.new({
+ host = host,
+ transitions = transitions,
+ target_factory = target_factory,
+ })
+
+ local result = service:acquire(
+ "f",
+ "n",
+ domain.Position.new(1, 1),
+ nil,
+ nil
+ )
+ same(domain.ActionKind.ERROR, result.outcome.kind)
+ same("search planning failed", result.outcome.diagnostic)
+ same("a", state:get_previous_target("n").value)
+ same(domain.ModeContext.from_full_mode("n"), state.last_input_context)
+ same(0, #state:temporary_overlay_identities())
+ same(0, map_size(host:highlights()))
+ same(prior.hidden, host:cursor_presentation().hidden)
+ same(prior.guicursor, host:cursor_presentation().guicursor)
+ same(
+ prior.terminal_cursor_visible,
+ host:cursor_presentation().terminal_cursor_visible
+ )
+ falsy(service:last_temporary_scope().active)
+ list_same({ "screen", "screen" }, host:redraws())
+ same(1, #host:diagnostics())
+ same("search planning failed", host:diagnostics()[1].text)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then
@@ -5769,4 +5823,4 @@ for _, item in ipairs(tests) do
passed = passed + 1
end
-io.stdout:write(string.format("Phase 11: %d tests passed\n", passed))
+io.stdout:write(string.format("Phase 12: %d tests passed\n", passed))