diff options
Diffstat (limited to 'tests')
| -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 |
