From d03647b4f814782bb720f14523802856f638caca Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 13:34:47 +0200 Subject: Verify nested fold opening --- tests/run.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 345f146..1906c6d 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -7129,6 +7129,30 @@ test("Primary preflight opens folds for horizontal and all policies", function() same(2, host:read_fold_state().closed_levels) end) +test("Primary preflight repeats fold opening until the line is visible", function() + local host = MemoryHost.new({ + fold_open_policy = { "horizontal" }, + closed_fold_levels = 3, + }) + sequence_coordinator.new({ host = host }):primary("t") + + local fold_operations = {} + for _, operation in ipairs(host:operations()) do + if operation.operation == "read_fold_state" + or operation.operation == "open_fold" + then + fold_operations[#fold_operations + 1] = operation.operation + end + end + list_same({ + "read_fold_state", + "open_fold", "read_fold_state", + "open_fold", "read_fold_state", + "open_fold", "read_fold_state", + }, fold_operations) + same(0, host:read_fold_state().closed_levels) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3