From dfcb8488df7bf89859b063a188d2be5c17ea75a8 Mon Sep 17 00:00:00 2001 From: mpaulson Date: Mon, 4 Dec 2023 12:15:00 -0700 Subject: [PATCH] fix: tests were breaking due to logging --- lua/harpoon/config.lua | 9 ++++++++- lua/harpoon/logger.lua | 3 ++- lua/harpoon/test/list_spec.lua | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/harpoon/config.lua b/lua/harpoon/config.lua index d38cf89..9301112 100644 --- a/lua/harpoon/config.lua +++ b/lua/harpoon/config.lua @@ -170,7 +170,14 @@ function M.get_default_config() if item then local pos = vim.api.nvim_win_get_cursor(0) - Logger:log("config_default#BufLeave updating position", bufnr, bufname, item, "to position", pos) + Logger:log( + "config_default#BufLeave updating position", + bufnr, + bufname, + item, + "to position", + pos + ) item.context.row = pos[1] item.context.col = pos[2] diff --git a/lua/harpoon/logger.lua b/lua/harpoon/logger.lua index 27ed51e..b8d368a 100644 --- a/lua/harpoon/logger.lua +++ b/lua/harpoon/logger.lua @@ -19,7 +19,8 @@ function HarpoonLog:log(...) local msg = {} for i = 1, select("#", ...) do - table.insert(msg, vim.inspect(select(i, ...))) + local item = select(i, ...) + table.insert(msg, vim.inspect(item)) end table.insert(self.lines, table.concat(msg, " ")) diff --git a/lua/harpoon/test/list_spec.lua b/lua/harpoon/test/list_spec.lua index d769667..6817cda 100644 --- a/lua/harpoon/test/list_spec.lua +++ b/lua/harpoon/test/list_spec.lua @@ -38,7 +38,7 @@ describe("list", function() local config = Config.merge_config({ foo = { select_with_nil = true, - select = function(list_item, options) + select = function(list_item, _, options) foo_selected = { list_item, options } end, },