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 603baad..fa9930e 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -5298,6 +5298,44 @@ test("Missing previous input preserves cursor and emits exact diagnostic", funct
)
end)
+test("Positive repeat timeout stores acquisition time", function()
+ local state, transitions = fresh_sequence_state()
+ transitions:SetRepeatTimestamp(17)
+ local host = MemoryHost.new({
+ time_ms = 84.75,
+ configuration = {
+ mark_cursor = false,
+ repeat_timeout_ms = 50,
+ },
+ input_packets = { { kind = "text", text = "a" } },
+ })
+ local result = acquisition_service.new({
+ host = host,
+ transitions = transitions,
+ }):acquire("f", "n", domain.Position.new(1, 1), nil, nil)
+ same(84.75, result.acquisition_time_ms)
+ same(84.75, state.repeat_timestamp_ms)
+
+ fresh_sequence_state()
+ transitions:SetRepeatTimestamp(17)
+ local zero_host = MemoryHost.new({
+ configuration = {
+ mark_cursor = false,
+ repeat_timeout_ms = 0,
+ },
+ input_packets = { { kind = "text", text = "a" } },
+ })
+ local zero_result = acquisition_service.new({
+ host = zero_host,
+ transitions = transitions,
+ }):acquire("f", "n", domain.Position.new(1, 1), nil, nil)
+ same(nil, zero_result.acquisition_time_ms)
+ same(17, state.repeat_timestamp_ms)
+ for _, operation in ipairs(zero_host:operations()) do
+ falsy(operation.operation == "read_time_ms")
+ end
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then