summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:17:20 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:17:20 +0200
commit14675353d21a63815901a729e3230d5928550868 (patch)
treece9b36fb92276c61349679caf0eb6c6d2e04638e /tests
parent3b1447358ce9ddddd454e080003c94c494320e6d (diff)
Create resolved motion plans
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 6ca2327..6d4ed3e 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -11,6 +11,7 @@ local capabilities = require("clever_f.capabilities")
local case_policy = require("clever_f.case_policy")
local policy = require("clever_f.policy")
local migemo_catalog = require("clever_f.migemo_catalog")
+local motion_plan = require("clever_f.motion_plan")
local sequence_state = require("clever_f.sequence_state")
local state_transitions = require("clever_f.state_transitions")
local text_topology = require("clever_f.text_topology")
@@ -2136,6 +2137,35 @@ test("Public Reset discards loaded Migemo dictionary objects", function()
same(2, catalog:load_count("utf-8"))
end)
+test("MotionPlanFactory combines resolved motion values", function()
+ local target_match = target_plan.build(target("a"), matching_policy())
+ local factory = motion_plan.new()
+ local descriptors = { "f", "F", "t", "T" }
+
+ for _, descriptor in ipairs(descriptors) do
+ local plan = factory:build(
+ target_match,
+ descriptor,
+ domain.SearchScope.CURRENT_LINE,
+ domain.EndpointPolicy.VISUAL_EXCLUSIVE
+ )
+ same(target_match, plan.target_plan)
+ same(domain.Descriptor.from_string(descriptor), plan.descriptor)
+ same(domain.SearchScope.CURRENT_LINE, plan.search_scope)
+ same(domain.EndpointPolicy.VISUAL_EXCLUSIVE, plan.endpoint_policy)
+ end
+
+ local defaulted = motion_plan.build(target_match, "f")
+ same(domain.SearchScope.BUFFER, defaulted.search_scope)
+ same(domain.EndpointPolicy.REGULAR, defaulted.endpoint_policy)
+ fails(function()
+ defaulted.search_scope = domain.SearchScope.CURRENT_LINE
+ end, "immutable")
+ fails(function()
+ factory:build({}, "f", "buffer", "regular")
+ end, "TargetPlan")
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then