summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 089f6dc..05a37f7 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -7338,6 +7338,43 @@ test("Repeated primary coordination evaluates timeout before reuse", function()
truthy(time_read ~= nil)
end)
+test("Expired primary repetition resets resources and reacquires pressed key", function()
+ local state, transitions = fresh_sequence_state()
+ local landing = domain.Position.new(1, 3)
+ local old_target = target("a")
+ local host = MemoryHost.new({
+ buffer_lines = { "ababa" },
+ cursor = landing,
+ input_packets = { { kind = "text", text = "b" } },
+ time_values_ms = { 120 },
+ configuration = {
+ repeat_timeout_ms = 10,
+ mark_cursor = false,
+ mark_char = false,
+ },
+ })
+ transitions:BeginAcquisition("n", "f")
+ transitions:CommitAcquiredTarget("n", old_target, 100)
+ transitions:CommitCommandSuccess("n", landing, true)
+ local overlay = host:create_highlight({
+ group = "CleverFChar",
+ window = "window-1",
+ positions = { landing },
+ })
+ transitions:AddTargetOverlay(overlay, "window-1", 1)
+ local timer = host:start_timer(50, function() end)
+ transitions:SetHighlightTimer(timer)
+
+ local resolution = sequence_coordinator.new({ host = host }):primary("T")
+
+ same("fresh", resolution.kind)
+ same(domain.Descriptor.TILL_BACKWARD, resolution.effective_descriptor)
+ same("b", resolution.target.value)
+ same(domain.Descriptor.TILL_BACKWARD, state:get_previous_descriptor("n"))
+ same(nil, host:highlights()[overlay])
+ falsy(host:timers()[timer].active)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then