diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-12 20:10:05 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-12 20:10:05 -0700 |
commit | 00a528818463b10d84699b2e0f4a960d5a4aeb5c (patch) | |
tree | b1c809b69934279b8655e64724b1ec6a31f7486d /tests/test_util.lua | |
parent | dd5b2f2f7ca01c2f28239cbbc7f97e6f9024cd94 (diff) |
fix: modify diff calculation to handle end-of-file newlines better (#35)
Diffstat (limited to 'tests/test_util.lua')
-rw-r--r-- | tests/test_util.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_util.lua b/tests/test_util.lua index a225aec..cded23a 100644 --- a/tests/test_util.lua +++ b/tests/test_util.lua @@ -1,5 +1,6 @@ require("plenary.async").tests.add_to_env() local conform = require("conform") +local log = require("conform.log") local M = {} local OUTPUT_FILE = "tests/fake_formatter_output" @@ -21,6 +22,8 @@ M.reset_editor = function() if vim.fn.filereadable(OUTPUT_FILE) == 1 then vim.fn.delete(OUTPUT_FILE) end + log.level = vim.log.levels.ERROR + log.set_handler(print) end ---@param lines string[] @@ -28,6 +31,8 @@ M.set_formatter_output = function(lines) local content = table.concat(lines, "\n") local fd = assert(vim.loop.fs_open(OUTPUT_FILE, "w", 420)) -- 0644 vim.loop.fs_write(fd, content) + -- Make sure we add the final newline + vim.loop.fs_write(fd, "\n") vim.loop.fs_close(fd) end |