Skip to content

Commit

Permalink
Avoid blank output triggering errors in fuzzer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bartels committed Dec 31, 2023
1 parent 19abfb2 commit 86f9766
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/fuzzer_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ describe("fuzzer", function()
end

local function make_edits(lines)
local was_empty = table.concat(lines):match("^%s*$")
lines = vim.deepcopy(lines)
for _ = 1, math.random(0, 3) do
do_insert(lines)
Expand All @@ -107,6 +108,12 @@ describe("fuzzer", function()
for _ = 1, math.random(0, 3) do
do_delete(lines)
end
-- avoid blank output (whitepsace only) which is ignored when applying formatting
if not was_empty then
while table.concat(lines):match("^%s*$") do
do_replace(lines)
end
end
return lines
end

Expand Down

0 comments on commit 86f9766

Please sign in to comment.