summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 65d831b..02f5e2d 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -3193,6 +3193,44 @@ test("Command execution applies the last reached count endpoint", function()
same(domain.Position.new(1, 5), outcome.position)
end)
+test("Incomplete command execution preserves successful history", function()
+ local state, transitions = fresh_sequence_state()
+ local previous_target = target("a")
+ local previous_landing = domain.Position.new(1, 1)
+ transitions:BeginAcquisition("n", "f")
+ transitions:CommitAcquiredTarget("n", previous_target, 25)
+ transitions:CommitCommandSuccess("n", previous_landing, false)
+
+ local host = MemoryHost.new({
+ buffer_lines = { "axaxa" },
+ cursor = previous_landing,
+ })
+ local executor = motion_executor.new(host)
+ local plan = motion_plan.build(
+ target_plan.build(previous_target, matching_policy()),
+ "f"
+ )
+ local descriptor_before = state:get_previous_descriptor("n")
+ local first_move_before = state:get_first_move("n")
+ local direction_before = state.moved_forward
+
+ local outcome = executor:execute(
+ text_topology.from_host(host),
+ "n",
+ plan,
+ 3,
+ false
+ )
+ same(domain.ActionKind.FAILED_SEARCH, outcome.kind)
+ same(domain.Position.new(1, 5), host:read_cursor())
+ same(previous_landing, state:get_previous_landing("n"))
+ same(descriptor_before, state:get_previous_descriptor("n"))
+ same(first_move_before, state:get_first_move("n"))
+ same(previous_target, state:get_previous_target("n"))
+ same(direction_before, state.moved_forward)
+ same(25, state.repeat_timestamp_ms)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then