From a6feffcc241cb86ddb359554de90c72cb1ba6b42 Mon Sep 17 00:00:00 2001 From: ray-x Date: Wed, 1 Nov 2023 12:31:28 +1100 Subject: [PATCH] gopls fill --- lua/tests/go_fillstruct_spec.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lua/tests/go_fillstruct_spec.lua b/lua/tests/go_fillstruct_spec.lua index 79312b9..a3b06fc 100644 --- a/lua/tests/go_fillstruct_spec.lua +++ b/lua/tests/go_fillstruct_spec.lua @@ -29,12 +29,20 @@ describe('should run fillstruct', function() require('go.reftool').fillstruct() - vim.cmd('sleep 2000m') -- allow cleanup - vim.cmd('sleep 2000m') -- allow cleanup - vim.cmd('write') - local filled = vim.api.nvim_buf_get_lines(0, 0, 40, false) + local filled, fmt + for _ = 1, 6 do + require('go.utils').log('waiting for fill') + vim.wait(1000, function() return false end) + vim.cmd([[wa]]) + + filled = vim.api.nvim_buf_get_lines(0, 0, 40, false) + fmt = vim.fn.join(vim.fn.readfile(path), '\n') + require('go.utils').log(vim.inspect(fmt)) + if expected == filled then + break + end + end - filled = vim.fn.join(filled, '\n') eq(expected, filled) end) end)