diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:05:52 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:05:52 +0200 |
| commit | 7d08a49b62eed6c4afcd19897670fb10930faa46 (patch) | |
| tree | f258ec84a2093df71a226fba34a43d47d52beaea /tests/run.lua | |
| parent | b5a2d9934368ff15fb195abc1ef69b45226c5b06 (diff) | |
Report missing previous 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 c968d87..69f5087 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5257,6 +5257,34 @@ test("Acquisition compares first codes with previous-input triggers", function() same(nil, acquisition_service.match_previous_input_trigger(122, { "xy" })) end) +test("Missing previous input preserves cursor and emits exact diagnostic", function() + fresh_sequence_state() + local origin = domain.Position.new(1, 2) + local host = MemoryHost.new({ + buffer_lines = { "abc" }, + cursor = origin, + configuration = { + mark_cursor = false, + hide_cursor_on_cmdline = false, + repeat_last_char_inputs = { "\r" }, + }, + input_packets = { { kind = "text", text = "\r" } }, + }) + local service = acquisition_service.new(host) + + local result = service:acquire("f", "n", origin, nil, nil) + truthy(result.missing_previous_input) + same(nil, result.target) + same(origin, host:read_cursor()) + same(1, #host:diagnostics()) + same("error", host:diagnostics()[1].level) + same("Previous input not found.", host:diagnostics()[1].text) + same( + acquisition_service.PREVIOUS_INPUT_NOT_FOUND, + host:diagnostics()[1].text + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
