diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:08:17 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:08:17 +0200 |
| commit | 5dbdb4010f2703d69fcd25a7045018aa3748c36b (patch) | |
| tree | 64deae7017b44e3842694b2ae7f65d82554d3496 /tests | |
| parent | b3459a82c42c62442ee4d7713b0fc5f9e6a4bf82 (diff) | |
Build live acquisition target plan
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 fa9930e..959de66 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5336,6 +5336,48 @@ test("Positive repeat timeout stores acquisition time", function() end end) +test("Acquisition builds one target plan from live matching policy", function() + fresh_sequence_state() + local host = MemoryHost.new({ + buffer_lines = { "aA" }, + configuration = { + mark_cursor = false, + ignore_case = false, + smart_case = false, + }, + input_packets = { { kind = "text", text = "a" } }, + }) + local policy_service = policy.new(host) + local underlying = target_plan.new({ policy = policy_service }) + local build_count = 0 + local factory = { + build = function(_, ...) + build_count = build_count + 1 + return underlying:build(...) + end, + } + local service = acquisition_service.new({ + host = host, + policy = policy_service, + target_factory = factory, + }) + host:set_configuration("ignore_case", true) + + local result = service:acquire( + "f", + "n", + domain.Position.new(1, 1), + nil, + nil + ) + same(1, build_count) + truthy(domain.TargetPlan.is(result.target_plan)) + same(domain.CaseMode.INSENSITIVE, result.target_plan.case_mode) + truthy(result.target_plan:matches("A")) + same(result.target, result.target_plan.target) + same(result.target_plan, service:last_temporary_scope().target_plan) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
