From 154f639078470763fa788d31fac9b020d26b7825 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:01:42 +0200 Subject: Discard terminal artifact packets --- tests/run.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index faad4ba..3f4c957 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5129,6 +5129,30 @@ test("Acquisition reads one raw packet after sequence start", function() same(1, reads) end) +test("Acquisition discards the terminal artifact packet", function() + fresh_sequence_state() + local artifact = domain.InputPacket.raw_bytes({ 0x80, 0xfd, 0x60 }) + local target_packet = domain.InputPacket.text("x") + local host = MemoryHost.new({ + configuration = { mark_cursor = false }, + input_packets = { artifact, target_packet }, + }) + local service = acquisition_service.new(host) + + service:acquire("f", "n", domain.Position.new(1, 1), nil, nil) + truthy(acquisition_service.is_terminal_artifact(artifact)) + falsy(acquisition_service.is_terminal_artifact(target_packet)) + same(target_packet, service:last_temporary_scope().input_packet) + + local reads = 0 + for _, operation in ipairs(host:operations()) do + if operation.operation == "read_input" then + reads = reads + 1 + end + end + same(2, reads) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3