diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:42:45 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:42:45 +0200 |
| commit | e9c90e1617cc1236788c813f93f9040f333707fd (patch) | |
| tree | 830c5c94c9f69655ecc136d8b426c9b28fb78af2 /tests/run.lua | |
| parent | d0a4b41cae2390d90bb9353756f67330a3ef8e80 (diff) | |
Rebuild reversed TILL feedback
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index b770884..e569cbb 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6472,6 +6472,45 @@ test("Repeated TILL migration compares movement directions", function() falsy(feedback_service.till_direction_changed(request)) end) +test("Direction-changing repeated TILL rebuilds feedback", function() + local state, transitions = fresh_sequence_state() + local host = MemoryHost.new({ buffer_lines = { "ababa" } }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local shared_target = target_plan.build(target("b"), matching_policy()) + local forward = motion_plan.build(shared_target, "t") + local backward = motion_plan.build(shared_target, "T") + local first = feedback:request_persistent({ + context = "n", + anchor = domain.Position.new(1, 1), + target_plan = shared_target, + motion_plan = forward, + window = "window-1", + }) + + local migration = feedback:migrate_command({ + context = "n", + origin = domain.Position.new(1, 3), + destination = domain.Position.new(1, 1), + outcome = domain.SearchOutcome.complete(domain.Position.new(1, 1), 1), + resolved_motion_plan = backward, + first_move = false, + moved_forward = false, + previous_moved_forward = true, + }) + + truthy(migration.migrated) + same( + feedback_service.MigrationReason.TILL_DIRECTION_CHANGE, + migration.reason + ) + falsy(first.identity == migration.overlay.identity) + same(nil, host:highlights()[first.identity]) + same(1, #state.target_overlays) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
