diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:40:39 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 13:40:39 +0200 |
| commit | 38d3c7480a5db02793dec95250a69b707f6af9d9 (patch) | |
| tree | 6c6df6d097b90ed4f27457689afd8ee41e8b11ea /tests | |
| parent | ae1c33d38ae1d7ae0a393298d1a92b711ab4d7d7 (diff) | |
Build live repeated target plan
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 3537f0a..da13a3b 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7442,6 +7442,42 @@ test("Primary repetition preserves the stored motion family", function() end end) +test("Primary repetition builds one target plan from live matching policy", function() + local _, transitions = fresh_sequence_state() + local landing = domain.Position.new(1, 2) + local stored_target = target("a") + transitions:BeginAcquisition("n", "f") + transitions:CommitAcquiredTarget("n", stored_target) + transitions:CommitCommandSuccess("n", landing, true) + local host = MemoryHost.new({ + buffer_lines = { "xAx" }, + cursor = landing, + configuration = { ignore_case = false }, + }) + local underlying = target_plan.new({ policy = policy.new(host) }) + local build_count = 0 + local factory = { + build = function(_, ...) + build_count = build_count + 1 + return underlying:build(...) + end, + } + local coordinator = sequence_coordinator.new({ + host = host, + target_factory = factory, + }) + + local sensitive = coordinator:primary("f") + same(1, build_count) + same(domain.CaseMode.SENSITIVE, sensitive.target_plan.case_mode) + falsy(sensitive.target_plan:matches("A")) + host:set_configuration("ignore_case", true) + local insensitive = coordinator:primary("f") + same(2, build_count) + same(domain.CaseMode.INSENSITIVE, insensitive.target_plan.case_mode) + truthy(insensitive.target_plan:matches("A")) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
