diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 1906c6d..e72114d 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7153,6 +7153,48 @@ test("Primary preflight repeats fold opening until the line is visible", functio same(0, host:read_fold_state().closed_levels) end) +test("Primary coordination asks RepeatResolver for acquisition or repetition", function() + local state, transitions = fresh_sequence_state() + local landing = domain.Position.new(1, 2) + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + cursor = landing, + }) + local coordinator = sequence_coordinator.new({ + host = host, + state = state, + transitions = transitions, + }) + local invocation = coordinator:read_primary_invocation() + + same(repeat_resolver.Decision.ACQUIRE, coordinator:decide_primary(invocation)) + transitions:CommitCommandSuccess("n", landing, true) + same(repeat_resolver.Decision.REPEAT, coordinator:decide_primary(invocation)) + host:set_macro_state("q") + invocation = coordinator:read_primary_invocation() + same(repeat_resolver.Decision.ACQUIRE, coordinator:decide_primary(invocation)) +end) + +test("Primary repetition guard runs after fold preflight", function() + fresh_sequence_state() + local host = MemoryHost.new({ + fold_open_policy = { "all" }, + closed_fold_levels = 2, + }) + local observed_levels + local resolver = { + decide = function() + observed_levels = host:read_fold_state().closed_levels + return repeat_resolver.Decision.ACQUIRE + end, + } + sequence_coordinator.new({ + host = host, + repeat_resolver = resolver, + }):primary("f") + same(0, observed_levels) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
