diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 2b1613c..09a0375 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3269,6 +3269,48 @@ test("A stationary first TILL completion is not forward movement", function() same(1, outcome.successful_steps) end) +test("Command success requests feedback migration before state commit", function() + local state, transitions = fresh_sequence_state() + local old_landing = domain.Position.new(1, 1) + transitions:BeginAcquisition("n", "f") + transitions:CommitAcquiredTarget("n", target("a")) + transitions:CommitCommandSuccess("n", old_landing, false) + + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + cursor = old_landing, + }) + local observed + local feedback = { + migrate_command = function(_, request) + observed = { + request = request, + cursor = host:read_cursor(), + landing = state:get_previous_landing("n"), + moved_forward = state.moved_forward, + } + end, + } + local plan = motion_plan.build( + target_plan.build(target("a"), matching_policy()), + "f" + ) + local outcome = motion_executor.new({ + host = host, + feedback_service = feedback, + }):execute(text_topology.from_host(host), "n", plan, 1, false) + + same(domain.ActionKind.MOVEMENT, outcome.kind) + same(old_landing, observed.request.origin) + same(domain.Position.new(1, 3), observed.request.destination) + same(plan, observed.request.resolved_motion_plan) + truthy(observed.request.moved_forward) + falsy(observed.request.previous_moved_forward) + same(domain.Position.new(1, 3), observed.cursor) + same(old_landing, observed.landing) + falsy(observed.moved_forward) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
