diff options
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 9ce65d2..7b50190 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5211,6 +5211,43 @@ test("Acquisition normalizes ordinary input to editor characters", function() same(1, control.first_code) end) +test("Acquisition compares first codes with previous-input triggers", function() + local _, transitions = fresh_sequence_state() + transitions:BeginAcquisition("v", "f") + transitions:CommitAcquiredTarget( + "v", + domain.TargetValue.character("h", 104) + ) + local host = MemoryHost.new({ + configuration = { + mark_cursor = false, + repeat_last_char_inputs = { "xy", "\r", "\227\129\130tail" }, + }, + input_packets = { { kind = "text", text = "x" } }, + }) + local service = acquisition_service.new({ + host = host, + transitions = transitions, + }) + + local result = service:acquire( + "f", + "n", + domain.Position.new(1, 1), + nil, + nil + ) + same("xy", result.previous_input_trigger) + same("xy", service:last_temporary_scope().previous_input_trigger) + local trigger, index = acquisition_service.match_previous_input_trigger( + 0x3042, + { "x", "\227\129\130more" } + ) + same("\227\129\130more", trigger) + same(2, index) + same(nil, acquisition_service.match_previous_input_trigger(122, { "xy" })) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
