summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 13:36:23 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 13:36:23 +0200
commit614eb6bd3f7059d297b4c940af5de154214091b3 (patch)
tree3280e586797c96d8ed58caaa14e0cbe4bf090700 /tests/run.lua
parent1ed91850daac2c4960e0bf316818de20341143fd (diff)
Acquire pressed primary targets
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua34
1 files changed, 31 insertions, 3 deletions
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