summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index cdda346..0e33c03 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6699,6 +6699,45 @@ test("Current timer callback clears timer and character overlays", function()
falsy(host:timers()[timer].active)
end)
+test("Timer cleanup preserves primary movement history", function()
+ local state, transitions = fresh_sequence_state()
+ local landing = domain.Position.new(1, 3)
+ local target_value = target("a")
+ local host = MemoryHost.new({
+ buffer_lines = { "aba" },
+ configuration = {
+ mark_char = true,
+ highlight_timeout_ms = 20,
+ },
+ })
+ local feedback = feedback_service.new({
+ host = host,
+ transitions = transitions,
+ })
+ local shared_target = target_plan.build(target_value, matching_policy())
+ local movement = motion_plan.build(shared_target, "f")
+ transitions:BeginAcquisition("n", "f")
+ transitions:CommitAcquiredTarget("n", target_value)
+ transitions:CommitCommandSuccess("n", landing, true)
+ feedback:request_persistent({
+ context = "n",
+ anchor = domain.Position.new(1, 1),
+ target_plan = shared_target,
+ motion_plan = movement,
+ window = "window-1",
+ })
+ local timer = feedback:start_highlight_timer("window-1")
+
+ host:fire_timer(timer)
+
+ same(domain.Descriptor.FIND_FORWARD, state:get_previous_descriptor("n"))
+ same(target_value, state:get_previous_target("n"))
+ same(landing, state:get_previous_landing("n"))
+ falsy(state:get_first_move("n"))
+ truthy(state.moved_forward)
+ same(domain.ModeContext.from_full_mode("n"), state.last_input_context)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then