From 37581bf1cbe3d6de7f7fad3c0de737062ba373bc Mon Sep 17 00:00:00 2001 From: ray-x Date: Wed, 1 Nov 2023 00:12:25 +1100 Subject: [PATCH] fillstruct refactor --- lua/tests/go_fillstruct_spec.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lua/tests/go_fillstruct_spec.lua b/lua/tests/go_fillstruct_spec.lua index db829c6bc..54753f800 100644 --- a/lua/tests/go_fillstruct_spec.lua +++ b/lua/tests/go_fillstruct_spec.lua @@ -12,16 +12,22 @@ describe('should run fillstruct', function() it('should run fillstruct', function() -- - local name = vim.fn.tempname() .. '.go' - local path = cur_dir .. '/lua/tests/fixtures/fill/fill_struct_input.go' -- %:p:h ? %:p - local lines = vim.fn.readfile(path) - vim.fn.writefile(lines, name) + -- local name = vim.fn.tempname() .. '.go' + -- local path = cur_dir .. '/lua/tests/fixtures/fill/fill_struct_input.go' -- %:p:h ? %:p + -- local lines = vim.fn.readfile(path) + -- vim.fn.writefile(lines, name) vim.o.ft = 'go' local expected = vim.fn.join( vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fill/fill_struct_golden.txt'), '\n' ) - local cmd = " silent exe 'e " .. path .. "'" + + local path = cur_dir .. '/lua/tests/fixtures/' -- %:p:h ? %:p + vim.cmd('cd ' .. path) + local fname = 'fill/fill_struct_input.go' + + vim.cmd('cd ' .. 'path') + local cmd = " silent exe 'e " .. fname .. "'" vim.cmd(cmd) require('plenary.reload').reload_module('go.nvim') require('go').setup({ verbose = true, lsp_cfg = true })