diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:36:49 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:36:49 +0200 |
| commit | acf8650a0f2d823f6d388d4d787ebfec134c35b0 (patch) | |
| tree | 183a770feaec19382574bd7a77e2522bf0075d12 /tests/run.lua | |
| parent | 614eb6bd3f7059d297b4c940af5de154214091b3 (diff) | |
Stop resolved acquisition outcomes
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 41 |
1 files changed, 41 insertions, 0 deletions
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 |
