diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:02:34 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:02:34 +0200 |
| commit | dbbbe30b637fccfacb15cd7317d4af87b658cfb5 (patch) | |
| tree | 8978cf092b8432a8f1e39d75ee4029f813a50fad /tests/run.lua | |
| parent | 154f639078470763fa788d31fac9b020d26b7825 (diff) | |
Normalize ordinary acquisition input
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 3f4c957..c279844 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5153,6 +5153,34 @@ test("Acquisition discards the terminal artifact packet", function() same(2, reads) end) +test("Acquisition normalizes ordinary input to editor characters", function() + fresh_sequence_state() + local multibyte = "\227\129\130" + local host = MemoryHost.new({ + configuration = { mark_cursor = false }, + input_packets = { + { kind = "text", text = multibyte }, + }, + }) + local service = acquisition_service.new(host) + service:acquire("f", "n", domain.Position.new(1, 1), nil, nil) + + local target = service:last_temporary_scope().acquired_target + same(domain.TargetKind.CHARACTER, target.kind) + same(multibyte, target.value) + same(0x3042, target.first_code) + + local ascii = acquisition_service.normalize_ordinary_input( + domain.InputPacket.raw_bytes({ 65 }) + ) + same("A", ascii.value) + same(65, ascii.first_code) + local control = acquisition_service.normalize_ordinary_input( + domain.InputPacket.text(string.char(1)) + ) + same(1, control.first_code) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
