summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua36
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