diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:57:10 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:57:10 +0200 |
| commit | b7af716a32e548987e3853f5e91198e53d051d27 (patch) | |
| tree | 659bcd3372f8c015b02c1da9c4f4c32483aaea18 /tests/run.lua | |
| parent | be971036f82c688e0a07fa2e3ff286e414cc5c1d (diff) | |
Execute resolved dot payloads
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 5dfe425..a237bd9 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3639,6 +3639,70 @@ test("Operator success creates a resolved dot payload", function() same(outcome.dot_payload, host:dot_repeat_payload()) end) +test("Dot payload replay uses resolved motions and current counts", function() + fresh_sequence_state() + local target_value = target("e") + local host = MemoryHost.new({ + buffer_lines = { "hoge fuge piye poye" }, + cursor = { line = 1, byte_column = 1 }, + mode = "no", + pending_operator = "delete", + }) + local plan = motion_plan.build( + target_plan.build(target_value, matching_policy()), + "f" + ) + local executor = motion_executor.new(host) + local outcomes = { + executor:execute( + text_topology.from_host(host), + "no", + plan, + 1, + true + ), + } + local buffers = { host:read_text():line(1) } + for _ = 1, 3 do + outcomes[#outcomes + 1] = host:replay_dot(1) + buffers[#buffers + 1] = host:read_text():line(1) + end + + list_same({ + " fuge piye poye", + " piye poye", + " poye", + "", + }, buffers) + for _, outcome in ipairs(outcomes) do + same(domain.ActionKind.MOVEMENT, outcome.kind) + same(domain.Descriptor.FIND_FORWARD, outcome.effective_descriptor) + same(domain.Position.new(1, 1), outcome.position) + truthy(domain.DotPayload.is(outcome.dot_payload)) + same(target_value, outcome.dot_payload.target) + end + + fresh_sequence_state() + local counted_host = MemoryHost.new({ + buffer_lines = { "hoge fuge piye poye" }, + cursor = { line = 1, byte_column = 1 }, + mode = "no", + pending_operator = "delete", + }) + local counted_executor = motion_executor.new(counted_host) + counted_executor:execute( + text_topology.from_host(counted_host), + "no", + plan, + 1, + true + ) + local counted = counted_host:replay_dot(2) + same(domain.ActionKind.MOVEMENT, counted.kind) + same(" poye", counted_host:read_text():line(1)) + same(2, counted.successful_steps) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
