summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:12:23 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:12:23 +0200
commit0455756954fff259e735ddda970df6a89b9b2f76 (patch)
tree2f9baa31f9ebfe5748580cd01474e7b11680fcbe /tests/run.lua
parentb544bbdf40214e9601aaff374b9f1ee2723e2189 (diff)
Build same-direction requests
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 598ea2b..f60dbc6 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -4086,6 +4086,31 @@ test("Reverse-request algorithm matches every direction matrix pair", function()
end
end)
+test("Explicit same-direction requests use the stored descriptor", function()
+ local _, transitions = fresh_sequence_state()
+ local stored_target = target("h")
+ local resolver = repeat_resolver.new()
+
+ for _, stored in ipairs({ "f", "F", "t", "T" }) do
+ transitions:BeginAcquisition("nov", stored)
+ transitions:CommitAcquiredTarget("noV", stored_target)
+ local request = resolver:same_direction_request(
+ "no" .. string.char(0x16)
+ )
+ truthy(domain.ExplicitRepeatRequest.is(request))
+ same(domain.Descriptor.from_string(stored), request.descriptor)
+ same(request.descriptor, request.effective_descriptor)
+ same(stored_target, request.target)
+ falsy(request.neutral)
+ end
+
+ local request = repeat_resolver.build_same_direction_request("f", stored_target)
+ same("f", request:to_table().descriptor)
+ fails(function()
+ request.descriptor = domain.Descriptor.FIND_BACKWARD
+ end, "immutable")
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then