summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua24
1 files changed, 24 insertions, 0 deletions
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