diff options
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index aa01e7f..76d6f50 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6589,6 +6589,41 @@ test("Highlight timeout requires marks delay and timer support", function() end end) +test("A new primary timer stops the prior timer first", function() + local _, transitions = fresh_sequence_state() + local host = MemoryHost.new({ + configuration = { + mark_char = true, + highlight_timeout_ms = 25, + }, + }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local first = feedback:start_highlight_timer() + host:clear_operations() + local second = feedback:start_highlight_timer() + local stop_index + local start_index + for index, operation in ipairs(host:operations()) do + if operation.operation == "stop_timer" and operation.identity == first then + stop_index = index + elseif operation.operation == "start_timer" + and operation.identity == second + then + start_index = index + end + end + + truthy(first ~= second) + truthy(stop_index ~= nil) + truthy(start_index ~= nil) + truthy(stop_index < start_index) + falsy(host:timers()[first].active) + truthy(host:timers()[second].active) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
