From f4e20f1a5127084cb79864c7d364beed51ee4000 Mon Sep 17 00:00:00 2001 From: Oleksandr Smirnov Date: Fri, 28 Feb 2025 14:39:13 +0200 Subject: [PATCH] refactor(gotests): use vim.system --- lua/gopher/gotests.lua | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lua/gopher/gotests.lua b/lua/gopher/gotests.lua index 1c177b6..e97f26c 100644 --- a/lua/gopher/gotests.lua +++ b/lua/gopher/gotests.lua @@ -67,16 +67,12 @@ local function add_test(args) log.debug("generating tests with args: ", args) - return r.sync(c.commands.gotests, { - args = args, - on_exit = function(data, status) - if not status == 0 then - error("gotests failed: " .. data) - end + local rs = r.sync { c.commands.gotests, unpack(args) } + if rs.code ~= 0 then + error("gotests failed: " .. rs.stderr) + end - u.notify "unit test(s) generated" - end, - }) + u.notify "unit test(s) generated" end -- generate unit test for one function