From e504a829432d9a80357f6c6416b4510070919a1c Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 11:41:59 +0200 Subject: Normalize direct preview counts --- tests/run.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index cbca8d9..7c4c52d 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4614,6 +4614,17 @@ test("Upper-case descriptors scan direct previews backward", function() ) end) +test("Direct preview count normalizes absent and entered values", function() + local planner = direct_preview_planner.new() + same(1, planner:normalize_count(nil)) + same(1, planner:normalize_count(domain.Count.ONE)) + same(2, planner:normalize_count(2)) + same(3, planner:normalize_count(domain.Count.new(3))) + fails(function() + planner:normalize_count(0) + end, "positive integer") +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3