From 614eb6bd3f7059d297b4c940af5de154214091b3 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 13:36:23 +0200 Subject: Acquire pressed primary targets --- tests/run.lua | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index e72114d..f004a23 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7072,7 +7072,10 @@ end) test("Primary coordination accepts only the four motion descriptors", function() local coordinator = sequence_coordinator.new({ host = MemoryHost.new() }) for _, value in ipairs({ "f", "F", "t", "T" }) do - same(domain.Descriptor.from_string(value), coordinator:primary(value)) + same( + domain.Descriptor.from_string(value), + coordinator:validate_primary_descriptor(value) + ) end fails(function() coordinator:primary("x") @@ -7104,11 +7107,12 @@ test("Primary coordination inspects fold policy during preflight", function() closed_fold_levels = 1, }) local coordinator = sequence_coordinator.new({ host = host }) + local invocation = coordinator:read_primary_invocation() - same(domain.Descriptor.FIND_FORWARD, coordinator:primary("f")) + local folds = coordinator:inspect_fold_open_policy(invocation) local operations = host:operations() same("read_fold_state", operations[#operations].operation) - truthy(host:read_fold_state():opens("horizontal")) + truthy(folds:opens("horizontal")) end) test("Primary preflight opens folds for horizontal and all policies", function() @@ -7195,6 +7199,30 @@ test("Primary repetition guard runs after fold preflight", function() same(0, observed_levels) end) +test("Acquiring primary coordination passes the pressed descriptor", function() + local state, transitions = fresh_sequence_state() + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + cursor = { line = 1, byte_column = 1 }, + input_packets = { { kind = "text", text = "a" } }, + configuration = { + mark_cursor = false, + mark_char = false, + }, + }) + local result = sequence_coordinator.new({ + host = host, + state = state, + transitions = transitions, + }):primary("t") + + truthy(acquisition_service.AcquisitionResult.is(result)) + truthy(result.resolved) + same(domain.Descriptor.TILL_FORWARD, result.request.descriptor) + same(domain.Descriptor.TILL_FORWARD, state:get_previous_descriptor("n")) + same("a", result.target.value) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3