From 8e5866eb12b129c6a27402d8bcc9848cc25b7513 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 5 Sep 2022 10:56:42 +1000 Subject: [PATCH] bench test with qucifix --- lua/go/asyncmake.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lua/go/asyncmake.lua b/lua/go/asyncmake.lua index 5da74f9..1eacc6a 100644 --- a/lua/go/asyncmake.lua +++ b/lua/go/asyncmake.lua @@ -110,6 +110,7 @@ function M.make(...) end end local compile_test = false + if makeprg:find("test") then if optarg["c"] then log("compile test") @@ -117,6 +118,7 @@ function M.make(...) efm = compile_efm() end end + if makeprg:find("go run") then runner = "go run" if args == nil or #args == 0 or (#args == 1 and args[1] == "-F") then @@ -147,12 +149,21 @@ function M.make(...) table.insert(cmd, "-tags=" .. tag:sub(f + 1)) end end + + local bench = false if makeprg:find("test") then log("go test") runner = "go test" efm = compile_efm() + for _, arg in ipairs(args) do + --check if it is bench test + if arg:find('-bench') then + bench = true + end + end + if optarg["v"] then table.insert(cmd, "-v") end @@ -160,12 +171,14 @@ function M.make(...) log("run test", efm) table.insert(cmd, "-run") end - if compile_test then + if not bench and compile_test then table.insert(cmd, "-c") end end - if args and #args > 0 then + if bench then + cmd = vim.list_extend(cmd, args) + elseif args and #args > 0 then cmd = vim.list_extend(cmd, reminder) end