From acf8650a0f2d823f6d388d4d787ebfec134c35b0 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 13:36:49 +0200 Subject: Stop resolved acquisition outcomes --- tests/run.lua | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index f004a23..0b83ef1 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7223,6 +7223,47 @@ test("Acquiring primary coordination passes the pressed descriptor", function() same("a", result.target.value) end) +test("Primary coordination stops on each acquisition outcome", function() + local cases = { + { + packet = { kind = "special_key", name = "Escape", bytes = { 27 } }, + kind = domain.ActionKind.ESCAPE, + }, + { + packet = { kind = "text", text = "\r" }, + kind = domain.ActionKind.EMPTY, + diagnostic = acquisition_service.PREVIOUS_INPUT_NOT_FOUND, + }, + { + packet = { kind = "error", message = "input unavailable" }, + kind = domain.ActionKind.ERROR, + diagnostic = "input unavailable", + }, + } + + for _, case in ipairs(cases) do + fresh_sequence_state() + local origin = domain.Position.new(1, 1) + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + cursor = origin, + input_packets = { case.packet }, + configuration = { + mark_cursor = false, + mark_char = false, + }, + }) + local outcome = sequence_coordinator.new({ host = host }):primary("f") + truthy(domain.ActionOutcome.is(outcome)) + same(case.kind, outcome.kind) + same(origin, outcome.position) + same(origin, host:read_cursor()) + if case.diagnostic ~= nil then + same(case.diagnostic, host:diagnostics()[1].text) + end + end +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3