summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua55
1 files changed, 54 insertions, 1 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 78789c6..42ebe89 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -4914,7 +4914,7 @@ test("Acquisition starts one temporary resource scope", function()
truthy(acquisition_service.AcquisitionRequest.is(result.request))
truthy(acquisition_service.TemporaryResourceScope.is(scope))
same(result.request, scope.request)
- truthy(scope.active)
+ falsy(scope.active)
same(1, service:started_scope_count())
end)
@@ -5057,6 +5057,7 @@ test("Acquisition emits the exact enabled prompt", function()
)
same("clever-f: ", acquisition_service.PROMPT)
list_same({ "clever-f: " }, host:prompts())
+ list_same({ "full" }, host:redraws())
fresh_sequence_state()
local macro_host = MemoryHost.new({
@@ -5459,6 +5460,58 @@ test("Acquisition requests eligible persistent target feedback", function()
falsy(feedback_service.persistent_context_eligible("no"))
end)
+test("Completed interactive prompt input requests a full redraw", function()
+ fresh_sequence_state()
+ local host = MemoryHost.new({
+ buffer_lines = { "ab" },
+ configuration = {
+ mark_cursor = false,
+ mark_direct = false,
+ mark_char = false,
+ show_prompt = true,
+ },
+ input_packets = { { kind = "text", text = "b" } },
+ })
+ acquisition_service.new(host):acquire(
+ "f",
+ "n",
+ domain.Position.new(1, 1),
+ nil,
+ nil
+ )
+ list_same({ "full" }, host:redraws())
+
+ local input_index
+ local redraw_index
+ for index, operation in ipairs(host:operations()) do
+ if operation.operation == "read_input" then
+ input_index = index
+ elseif operation.operation == "redraw" and operation.kind == "full" then
+ redraw_index = index
+ end
+ end
+ truthy(redraw_index > input_index)
+
+ fresh_sequence_state()
+ local escape_host = MemoryHost.new({
+ configuration = {
+ mark_cursor = false,
+ show_prompt = true,
+ },
+ input_packets = {
+ { kind = "special_key", name = "Escape", bytes = { 27 } },
+ },
+ })
+ acquisition_service.new(escape_host):acquire(
+ "f",
+ "n",
+ domain.Position.new(1, 1),
+ nil,
+ nil
+ )
+ same(0, #escape_host:redraws())
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then