diff options
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 25 |
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 |
